Boost logo

Boost Testing :

From: Bronek Kozicki (brok_at_[hidden])
Date: 2006-03-22 17:16:49


Rene Rivera wrote:
> 2. It times clock duration not idle or unresponsive time.

there is cure for this limitation - see attached .diff . It would be
nice to see this working in bjam v2 :)

PS. sorry for resurrecting old thread ...

--- C:\DATA\USERS\Bronek\My Documents\CPP\jam\src\execnt.c Wed Mar 22 21:52:58 2006 UTC
+++ C:\DEVEL\jam_src\execnt.c Wed Mar 22 21:56:15 2006 UTC
@@ -897,74 +897,10 @@
     return result;
 }
 
-int is_parent_child(DWORD parent, DWORD child)
-{
- HANDLE process_snapshot_h = INVALID_HANDLE_VALUE;
-
- if (parent == child)
- return 1;
-
- process_snapshot_h = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
- if (INVALID_HANDLE_VALUE != process_snapshot_h)
- {
- BOOL ok = TRUE;
- PROCESSENTRY32 pinfo;
- pinfo.dwSize = sizeof(PROCESSENTRY32);
- for (
- ok = Process32First(process_snapshot_h, &pinfo);
- ok == TRUE;
- ok = Process32Next(process_snapshot_h, &pinfo) )
- {
- if (pinfo.th32ProcessID == child && pinfo.th32ParentProcessID)
- return is_parent_child(parent, pinfo.th32ParentProcessID);
- }
-
- CloseHandle(process_snapshot_h);
- }
-
- return 0;
-}
-
-int related(HANDLE h, DWORD p)
-{
- return is_parent_child(get_process_id(h), p);
-}
-
-BOOL CALLBACK window_enum(HWND hwnd, LPARAM lParam)
-{
- char buf[10] = {0};
- HANDLE h = *((HANDLE*) (lParam));
- DWORD pid = 0;
-
- if (!GetClassNameA(hwnd, buf, 10))
- return TRUE; // failed to read class name
-
- if (strcmp(buf, "#32770"))
- return TRUE; // not a dialog
-
- GetWindowThreadProcessId(hwnd, &pid);
- if (related(h, pid))
- {
- PostMessage(hwnd, WM_QUIT, 0, 0);
- // just one window at a time
- return FALSE;
- }
-
- return TRUE;
-}
-
-void close_alert(HANDLE process)
-{
- EnumWindows(&window_enum, (LPARAM) &process);
-}
-
 static double
 running_time(HANDLE process)
 {
     FILETIME creation, exit, kernel, user, current;
-
- close_alert(process);
-
     if (GetProcessTimes(process, &creation, &exit, &kernel, &user))
     {
         /* Compute the elapsed time */


Boost-testing list run by mbergal at meta-comm.com