public static string dumpProcStats(ProcessStatsEventArgs procStats)
 {
     System.Text.StringBuilder sb = new System.Text.StringBuilder();
     foreach (KeyValuePair<string, process_statistics> ps in procStats.procStatistics)
     {
         sb.Append(ps.Value.sName + "\t");
         sb.Append((ps.Value.procUsage.kernel + ps.Value.procUsage.user).ToString() + "\r\n");
     }
     sb.Append("Duration:\t" + procStats.duration + "\r\n");
     return sb.ToString();
 }
Esempio n. 2
0
 public static string dumpProcStats(ProcessStatsEventArgs procStats)
 {
     System.Text.StringBuilder sb = new System.Text.StringBuilder();
     foreach (KeyValuePair <string, process_statistics> ps in procStats.procStatistics)
     {
         sb.Append(ps.Value.sName + "\t");
         sb.Append((ps.Value.procUsage.kernel + ps.Value.procUsage.user).ToString() + "\r\n");
     }
     sb.Append("Duration:\t" + procStats.duration + "\r\n");
     return(sb.ToString());
 }
Esempio n. 3
0
 void onUpdateHandler(ProcessStatsEventArgs procStats)
 {
     //anyone listening?
     if (this.updateEvent == null)
         return;
     this.updateEvent(this, procStats);
 }
Esempio n. 4
0
 void pInfo_updateEvent(object sender, ProcessStatsEventArgs eventArgs)
 {            
     setText( ProcessStatistics.dumpProcStats(eventArgs));
     addData(eventArgs);
 }
Esempio n. 5
0
 void addData (ProcessStatsEventArgs procStats)
 {
     if (this.dataGrid1.InvokeRequired)
     {
         addDataCallback d = new addDataCallback(addData);
         this.Invoke(d, new object[] { procStats });
     }
     else
     {
         dataGrid1.SuspendLayout();
         //dtProcesses.Rows.Clear();
         foreach (KeyValuePair<string, ProcessStatistics.process_statistics> ps in procStats.procStatistics)
         {
             object[] o = new object[] { 
                 ps.Value.processID,
                 ps.Value.sName, 
                 ps.Value.procUsage.user, 
                 ps.Value.procUsage.kernel,
                 ps.Value.dateTime,
                 ps.Value.duration
                 };
             DataRow dr;
             //check if data already exists
             dr = dsProcesses.Tables[0].Rows.Find(ps.Value.processID.ToString());
             if (dr == null)
             {   //add a new row
                 dr = dtProcesses.NewRow();
                 dr.ItemArray = o;
                 dtProcesses.Rows.Add(dr);
             }
             else
                 dr.ItemArray = o;
         }
         dataGrid1.Refresh();
         dataGrid1.ResumeLayout();
         //object[] o = new object[7]{ procUsage.procStatistics. .procStatistics. [i].sApp, eventEntries[i].sArg, eventEntries[i].sEvent, 
         //        eventEntries[i].sStartTime, eventEntries[i].sEndTime, eventEntries[i].sType, eventEntries[i].sHandle };
     }
     
 }