Return-Path: Delivered-To: apmail-incubator-stdcxx-commits-archive@www.apache.org Received: (qmail 32112 invoked from network); 10 Aug 2007 17:48:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Aug 2007 17:48:28 -0000 Received: (qmail 14390 invoked by uid 500); 10 Aug 2007 17:48:25 -0000 Delivered-To: apmail-incubator-stdcxx-commits-archive@incubator.apache.org Received: (qmail 14376 invoked by uid 500); 10 Aug 2007 17:48:25 -0000 Mailing-List: contact stdcxx-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-commits@incubator.apache.org Received: (qmail 14338 invoked by uid 99); 10 Aug 2007 17:48:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Aug 2007 10:48:24 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,UPPERCASE_50_75 X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Aug 2007 17:48:27 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id AFC4C1A981A; Fri, 10 Aug 2007 10:48:02 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r564694 - /incubator/stdcxx/trunk/util/exec.cpp Date: Fri, 10 Aug 2007 17:48:02 -0000 To: stdcxx-commits@incubator.apache.org From: faridz@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070810174802.AFC4C1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: faridz Date: Fri Aug 10 10:48:01 2007 New Revision: 564694 URL: http://svn.apache.org/viewvc?view=rev&rev=564694 Log: 2007-08-10 Farid Zaripov * exec.cpp (fttoull) [_WIN32]: New function to convert from FILETIME to ULONGLONG. (exec_file) [_WIN32]: Get kernel time and user time of the child process using GetProcessTimes(). Map STATUS_FLOAT_STACK_CHECK to SIGSTKFLT signal instead of SIGFPE. Modified: incubator/stdcxx/trunk/util/exec.cpp Modified: incubator/stdcxx/trunk/util/exec.cpp URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/exec.cpp?view=diff&rev=564694&r1=564693&r2=564694 ============================================================================== --- incubator/stdcxx/trunk/util/exec.cpp (original) +++ incubator/stdcxx/trunk/util/exec.cpp Fri Aug 10 10:48:01 2007 @@ -50,13 +50,16 @@ # endif # include /* for PROCESS_INFORMATION, CreateProcess, ... */ # ifndef SIGTRAP -# define SIGTRAP 5 // STATUS_BREAKPOINT translated into SIGTRAP +# define SIGTRAP 5 // STATUS_BREAKPOINT translated into SIGTRAP # endif # ifndef SIGBUS -# define SIGBUS 10 // STATUS_IN_PAGE_ERROR translated into SIGBUS +# define SIGBUS 10 // STATUS_IN_PAGE_ERROR translated into SIGBUS # endif # ifndef SIGSYS -# define SIGSYS 12 // STATUS_INVALID_PARAMETER translated into SIGSYS +# define SIGSYS 12 // STATUS_INVALID_PARAMETER translated into SIGSYS +# endif +# ifndef SIGSTKFLT +# define SIGSTKFLT 16 // STATUS_FLOAT_STACK_CHECK translated into SIGSTKFLT # endif # ifndef STATUS_INVALID_PARAMETER # define STATUS_INVALID_PARAMETER ((DWORD)0xC000000DL) @@ -869,23 +872,23 @@ DWORD nt_status; int signal; } nt_status_map [] = { - { STATUS_BREAKPOINT, SIGTRAP }, - { STATUS_ACCESS_VIOLATION, SIGSEGV }, - { STATUS_STACK_OVERFLOW, SIGSEGV }, - { STATUS_STACK_BUFFER_OVERRUN, SIGSEGV }, - { STATUS_IN_PAGE_ERROR, SIGBUS }, - { STATUS_ILLEGAL_INSTRUCTION, SIGILL }, - { STATUS_PRIVILEGED_INSTRUCTION, SIGILL }, - { STATUS_FLOAT_DENORMAL_OPERAND, SIGFPE }, - { STATUS_FLOAT_DIVIDE_BY_ZERO, SIGFPE }, - { STATUS_FLOAT_INEXACT_RESULT, SIGFPE }, - { STATUS_FLOAT_INVALID_OPERATION, SIGFPE }, - { STATUS_FLOAT_OVERFLOW, SIGFPE }, - { STATUS_FLOAT_STACK_CHECK, SIGFPE }, - { STATUS_FLOAT_UNDERFLOW, SIGFPE }, - { STATUS_INTEGER_DIVIDE_BY_ZERO, SIGFPE }, - { STATUS_INTEGER_OVERFLOW, SIGFPE }, - { STATUS_INVALID_PARAMETER, SIGSYS } + { STATUS_BREAKPOINT, SIGTRAP }, + { STATUS_ACCESS_VIOLATION, SIGSEGV }, + { STATUS_STACK_OVERFLOW, SIGSEGV }, + { STATUS_STACK_BUFFER_OVERRUN, SIGSEGV }, + { STATUS_IN_PAGE_ERROR, SIGBUS }, + { STATUS_ILLEGAL_INSTRUCTION, SIGILL }, + { STATUS_PRIVILEGED_INSTRUCTION, SIGILL }, + { STATUS_FLOAT_DENORMAL_OPERAND, SIGFPE }, + { STATUS_FLOAT_DIVIDE_BY_ZERO, SIGFPE }, + { STATUS_FLOAT_INEXACT_RESULT, SIGFPE }, + { STATUS_FLOAT_INVALID_OPERATION, SIGFPE }, + { STATUS_FLOAT_OVERFLOW, SIGFPE }, + { STATUS_FLOAT_UNDERFLOW, SIGFPE }, + { STATUS_INTEGER_DIVIDE_BY_ZERO, SIGFPE }, + { STATUS_INTEGER_OVERFLOW, SIGFPE }, + { STATUS_FLOAT_STACK_CHECK, SIGSTKFLT }, + { STATUS_INVALID_PARAMETER, SIGSYS } }; @@ -1020,6 +1023,15 @@ warn_last_error ("Waiting for child process"); } +/* FILETIME to ULONGLONG */ +inline ULONGLONG fttoull (const FILETIME& ft) +{ + ULARGE_INTEGER __ft; + __ft.LowPart = ft.dwLowDateTime; + __ft.HighPart = ft.dwHighDateTime; + return __ft.QuadPart; +} + void exec_file (const struct target_opts* options, struct target_status* result) { char* merged; @@ -1165,9 +1177,22 @@ const DWORD UNITS_PER_CLOCK = UNITS_PER_SEC / CLOCKS_PER_SEC; assert (UNITS_PER_CLOCK * CLOCKS_PER_SEC == UNITS_PER_SEC); - /* We're ignoring dwHighDateTime, as it's outside the percision of clock_t - */ - wall = (end.dwLowDateTime - start.dwLowDateTime) / UNITS_PER_CLOCK; +#if _WIN32_WINNT >= 0x0500 + FILETIME stime, utime; + static clock_t user, sys; + if (GetProcessTimes (child.hProcess, &start, &end, &stime, &utime)) { + user = clock_t (fttoull (utime) / UNITS_PER_CLOCK); + sys = clock_t (fttoull (stime) / UNITS_PER_CLOCK); + + /* Link the delta */ + result->user = &user; + result->sys = &sys; + } + else + warn_last_error ("Getting child process times"); +#endif // _WIN32_WINNT >= 0x0500 + + wall = clock_t ((fttoull (end) - fttoull (start)) / UNITS_PER_CLOCK); /* Link the delta */ result->wall = &wall;