Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
とにかく、すべての着信ユーザーを相互リンクして (CMD の netstat -a)、監視システムを作成して、Python で各ユーザーが使用する CPU の割合を追跡できますか。Windows システムはログ ファイルを書き込みますか? psutil を使用してプロセスごとの CPU 使用率を確認しましたが、ユーザーごとの CPU 使用率を表示する方法がわかりません。助けてください。ありがとう!
ユーザーごとの CPU 使用率を把握することはできません。次のように、特定のユーザーが所有するプロセスの CPU 使用率を把握することができます。
for p in psutil.process_iter(): if p.username == 'someusername': print p.get_cpu_percent(interval=1)
ただし、合計を取得するためにそれらすべてを合計しても、意味のある値が得られる可能性は低いです。