擅长:python、mysql、java
<p>在activestate上还有另一个配方,它做了类似的事情,但是使用了Performance Data Helper library(PDH)。</p>
<p>我已经在我的Windows7 64位机上测试过了,它在那里工作——所以大概相同的功能在32位和64位机上都能工作。</p>
<p>你可以在这里找到食谱:<a href="http://code.activestate.com/recipes/303339/" rel="noreferrer">http://code.activestate.com/recipes/303339/</a></p>
<p>另一种方法是使用WMI,Python中有一个使用<a href="http://timgolden.me.uk/python/wmi/index.html" rel="noreferrer">wmi</a>模块的示例:</p>
<p><a href="http://timgolden.me.uk/python/wmi/cookbook.html" rel="noreferrer">http://timgolden.me.uk/python/wmi/cookbook.html</a></p>
<pre><code>import wmi
c = wmi.WMI ()
for process in c.Win32_Process ():
print process.ProcessId, process.Name
</code></pre>