> Is there a way to get a list of all children of a process via pywin32? > > These would be all processes launched from calls like popen(), system() > and QProcess(). > > Alternatively, is there a way to get the total CPU time (user and > kernel) of all children of a python session? > Note that os.times() does not work on Windows and on Linux it only post > the children time when the children exit.
You can do this with WMI: import win32com.client wmi=win32com.client.GetObject('winmgmts:') for p in wmi.InstancesOf('win32_process'): print p.Name, p.Properties_('ProcessId'), \ int(p.Properties_('UserModeTime').Value)+int(p.Properties_('KernelModeTime').Value) children=wmi.ExecQuery('Select * from win32_process where ParentProcessId=%s' %p.Properties_('ProcessId')) for child in children: print '\t',child.Name,child.Properties_('ProcessId'), \ int(child.Properties_('UserModeTime').Value)+int(child.Properties_('KernelModeTime').Value) hth Roger _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32