如何知道进程写操作的数量? [英] How to know count of process(es) write operations ?

查看:64
本文介绍了如何知道进程写操作的数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想可以用performanceCounter来做..
请帮忙.
写操作"或记录计数",我不知道怎么说正确,因为我的操作系统是非英语的.就像您在任务管理器"的进程列表中看到的一样,这就是我想要做的.或换句话说:
如果您复制了一个文件,则该计数器为explorer.exe + = 1;

I guess it''s possible to do using performanceCounter..
Please, help.
"Write operations" or "records count", I don''t know how to say correctly, because my OS is non-English. Just what you see in process list of your Task Manager, that is what I trying to do. Or by another words:
if you copied one file, this counter for explorer.exe +=1;

推荐答案

我相信您希望在进程将某些内容写入文件时进行跟踪.如果您不这样做,那么以下操作将无济于事.

我认为您将需要FileSystemWatcherProcessModulesCollection的组合.首先,您需要设置一个观察器以查看将什么内容写入文件.然后,您将需要遍历Process.Modules集合以查找该进程是否已锁定文件.在某些情况下,对我来说似乎效率很低而且不正确,但这就是我现在能想到的.可能有人可以改善我的解决方案. :)
I believe you want to track whenever a process writes something to a file. If you do not, following will not help.

I think you will need a combination of FileSystemWatcher and ProcessModulesCollection. First you need to set up a watcher to see whenever something is written to a file. Then, you will need to iterate through the Process.Modules collection to find if that process has locked the file. Seems a very inefficient and incorrect in some cases way to me but that is what I could come up with for now. May be someone can better my solution. :)


这篇关于如何知道进程写操作的数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆