コード例 #1
0
        protected void addInfoToTable(Process process, DataTable table, int threadId, long ticks, DateTime pollCycleTimeStamp,
                                      DateTime startTimeStamp, bool threadLevel, IO_COUNTERS ioCounters)
        {
            ThreadInfo threadInfo = new ThreadInfo();

            threadInfo.processId          = process.Id;
            threadInfo.threadId           = threadId;
            threadInfo.cpuTime            = ticks;
            threadInfo.pollTimeStamp      = DateTime.UtcNow;
            threadInfo.pollCycleTimeStamp = pollCycleTimeStamp;
            threadInfo.startTimeStamp     = startTimeStamp;
            threadInfo.host        = HostName;
            threadInfo.threadLevel = threadLevel;
            threadInfo.process     = StringUtil.ReplaceSubString(process.ProcessName, "^(control-|run-)");

            threadInfo.readOperationCount  = ioCounters.ReadOperationCount;
            threadInfo.writeOperationCount = ioCounters.WriteOperationCount;
            threadInfo.otherOperationCount = ioCounters.OtherOperationCount;
            threadInfo.readTransferCount   = ioCounters.ReadTransferCount;
            threadInfo.writeTransferCount  = ioCounters.WriteTransferCount;
            threadInfo.otherTransferCount  = ioCounters.OtherTransferCount;

            // When on process level add threadCount as well
            if (threadId == -1)
            {
                threadInfo.threadCount = process.Threads.Count;
                threadInfo.workingSet  = process.WorkingSet64;
            }
            ThreadTables.addToTable(table, threadInfo);
        }
コード例 #2
0
 static extern bool GetProcessIoCounters(IntPtr hProcess, out IO_COUNTERS lpIoCounters);