Juan José muchas gracias por el código, pero analizando el mismo mi compañero en realidad tiene problemas con el FT0 que indica cuanto tiempo consumió el Thread que es un Nro. que según lo que dice MSDN si esa variable contiene : 10.000.000 equivale a 1 segundo, pero cuando él quiere aplicar equivalencias de conversión no llega a ningún valor razonable, tampoco sabe contra qué comparar el valor obtenido. Ejemplo : Si el Thread tardó 30 minutos, la suma de estas variables lpKernelTime + lpUserTime tiene que dar 30 minutos ?. En realidad no sé dá cuenta cómo convertirlo a un tiempo en segundos, milisegundos, nanosegundos o lo que sea, pero que el valor sea comprensible para poder mostrarlo en pantalla o en un archivo de log.
Nancy Galletti Dpto. de Sistemas - Cabal C.L. TE : 4891-2600 Int.: 2387 / 4891-2654 [EMAIL PROTECTED] -----Mensaje original----- De: Juan Jose Costello Levien [mailto:[EMAIL PROTECTED] Enviado el: Martes, 04 de Noviembre de 2008 11:01 Para: vbusers List Member Asunto: [vbusers] Re: consulta de un compañero que esta en la facultad y tiene que hacer lo que adjunto Prueben esto en VB: Private Type FILETIME dwLowDateTime As Long dwHighDateTime As Long End Type Private Type SYSTEMTIME wYear As Integer wMonth As Integer wDayOfWeek As Integer wDay As Integer wHour As Integer wMinute As Integer wSecond As Integer wMilliseconds As Integer End Type Private Declare Function GetThreadTimes Lib "kernel32" (ByVal hThread As Long, lpCreationTime As FILETIME, lpExitTime As FILETIME, lpKernelTime As FILETIME, lpUserTime As FILETIME) As Long Private Declare Function FileTimeToLocalFileTime Lib "kernel32" (lpFileTime As FILETIME, lpLocalFileTime As FILETIME) As Long Private Declare Function FileTimeToSystemTime Lib "kernel32" (lpFileTime As FILETIME, lpSystemTime As SYSTEMTIME) As Long Private Declare Function GetCurrentThread Lib "kernel32" () As Long Private Sub Form_Load() Dim FT0 As FILETIME, FT1 As FILETIME, ST As SYSTEMTIME GetThreadTimes GetCurrentThread, FT1, FT0, FT0, FT0 FileTimeToLocalFileTime FT1, FT1 FileTimeToSystemTime FT1, ST MsgBox "This thread was started at " + CStr(ST.wHour) + ":" + CStr(ST.wMinute) + "." + CStr(ST.wSecond) + " on " + CStr(ST.wMonth) + "/" + CStr(ST.wDay) + "/" + CStr(ST.wYear) End Sub On Tue, Nov 4, 2008 at 12:31 PM, Galletti, Nancy < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: Que tal listeros, hoy les adjunto una consulta para ayudar a un compañero de trabajo, se las paso por si alguien puede ayudar, desde ya muchas gracias a todos de antemano: Esta funcion que viene atrás definida devuelve 4 parametros, pero hay dos (lpKernelTime y lpUserTime)que según el MSDN da una cantidad que representa el nro de intervalos de 100 nanosegundos c/u desde el 1ro de enero de 1601. Ahora.....como hacemos para pasar eso a un tiempo normal???, por ejemplo segundos????? Y la otra pregunta seria, si hago la diferencia lpExitTime menos lpCreationTime Me da igual a lpKernelTime + lpUserTime??? Es decir lpExitTime - lpCreationTime = lpKernelTime + lpUserTime Nos estamos volviendo locos con esta cuestion y ya probamos 40 formas distintas de conversión pero no llegamos a nada. Gracias!!!! GetThreadTimes Send Feedback <mailto: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> ?subject=Product: Windows CE | Version: 5.0 FP NMD | Release: Platform Builder | Title: GetThreadTimes | Filename: wce50lrfgetthreadtimes.htm | Built on: Thursday, February 02, 2006&body=We cannot answer technical su This function obtains timing information about a specified thread. BOOL GetThreadTimes ( HANDLE hThread, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime ); Parameters hThread [in] Open handle that specifies the thread whose timing information is sought. This handle must be created with THREAD_QUERY_INFORMATION access. lpCreationTime [out] Long pointer to a FILETIME < http://msdn.microsoft.com/en-us/library/ms885586.aspx <http://msdn.microsoft.com/en-us/library/ms885586.aspx> > structure that receives the creation time of the thread. lpExitTime [out] Long pointer to a FILETIME structure that receives the exit time of the thread. If the thread has not exited, the content of this structure is undefined. lpKernelTime [out] Long pointer to a FILETIME structure that receives the amount of time the thread executed in kernel mode. lpUserTime [out] Pointer to a FILETIME structure that receives the amount of time the thread executed in user mode. Return Values Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError < http://msdn.microsoft.com/en-us/library/ms885627.aspx <http://msdn.microsoft.com/en-us/library/ms885627.aspx> >. Remarks All times are expressed using FILETIME data structures. Such a structure contains two 32-bit values that combine to form a 64-bit count of 100-nanosecond time units. Thread creation and exit times are points in time expressed as the amount of time that has elapsed since midnight on January 1, 1601 at Greenwich, England. Thread kernel mode and user mode times are amounts of time. For example, if a thread spends one second in kernel mode, this function fills the FILETIME structure specified by lpKernelTime with a 64-bit value of ten million. That is the number of 100-nanosecond units in one second. The following support restrictions are for GetThreadTimes for Windows CE 2.10 through 2.12: * The lpCreationTime, lpExitTime, and lpKernelTime parameters are not supported. They are always returned as zero. * The lpUserTime parameter reports the total time a thread has been running. There is no distinction between user and kernel modes. * The lpUserTime parameter is not valid when the thread exits. Gustavo Alvarez Organizaciòn y Sistemas, Cabal Coop. Ltda. ?4891-2600 Int. 2372 ? [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> Nancy Galletti Dpto. de Sistemas - Cabal C.L. TE : 4891-2600 Int.: 2387 / 4891-2654 [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> -- Juan Jose Costello Levien [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
