Changeset 3319

Show
Ignore:
Timestamp:
12/24/09 15:54:20 (10 years ago)
Author:
armon
Message:

Fixes for darwin_api using getresources on 64 bit.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • seattle/trunk/repy/darwin_api.py

    r3191 r3319  
    9090    _fields_ = [("tv_sec", ctypes.c_long), 
    9191                ("tv_usec", ctypes.c_long)] 
    92      
     92 
     93class time_value_t(ctypes.Structure): 
     94    _fields_ = [("seconds", ctypes.c_int), 
     95                ("microseconds",ctypes.c_int)] 
     96 
    9397# Provides the struct thread_basic_info, which is used 
    9498# to retrieve information about a thread 
    9599class thread_basic_info(ctypes.Structure): 
    96   _fields_ = [("user_time", timeval), 
    97                ("system_time",timeval), 
     100  _fields_ = [("user_time", time_value_t), 
     101               ("system_time",time_value_t), 
    98102               ("cpu_usage",ctypes.c_int), 
    99103               ("policy",ctypes.c_int), 
     
    243247 
    244248  # Sum up the CPU usage 
    245   cpu_time = thread_info.user_time.tv_sec + thread_info.user_time.tv_usec / 1000000.0 
    246   cpu_time += thread_info.system_time.tv_sec + thread_info.system_time.tv_usec / 1000000.0 
     249  cpu_time = thread_info.user_time.seconds + thread_info.user_time.microseconds / 1000000.0 
     250  cpu_time += thread_info.system_time.seconds + thread_info.system_time.microseconds / 1000000.0 
    247251 
    248252  # Safety check, result should be 0