//public process_statistics(uint uProcessID, string s, process_usage u, long dt, uint du) //{ // sName = s; // processID = uProcessID; // procUsage = u; // dateTime = dt; // duration = du; //} /// <summary> /// an object to hold informations about a process /// </summary> /// <param name="uProcessID">the Process ID</param> /// <param name="s">the process name</param> /// <param name="u">the process usage (kernel and user times)</param> /// <param name="dt">a timestamp</param> /// <param name="du">the elapsed time since last statistic</param> /// <param name="threadList">a list of all threads of this process</param> public process_statistics(uint uProcessID, string s, process_usage u, long dt, uint du, List <threadStatistic> threadList) { sName = s; processID = uProcessID; procUsage = u; dateTime = dt; duration = du; ThreadStatList = threadList; }
public process_statistics FromByte(byte[] buf) { int offset = 0; Int16 bLen = BitConverter.ToInt16(buf, 0); //2 bytes offset += sizeof(System.Int16); if (bLen > 0) { this.sName = System.Text.Encoding.UTF8.GetString(buf, offset, bLen); } offset += bLen; this.dateTime = BitConverter.ToInt64(buf, offset); offset += sizeof(System.Int64); this.duration = BitConverter.ToUInt32(buf, offset); offset += sizeof(System.Int32); this.procUsage = new process_usage(ref buf, ref offset); //offset = offset; //has been changed by process_usage this.processID = BitConverter.ToUInt32(buf, offset); offset += sizeof(System.UInt32); //how many thtreads are in the byte stream Int16 iCnt = BitConverter.ToInt16(buf, offset); offset += sizeof(System.Int16); //start reading the threads List <threadStatistic> thList = new List <threadStatistic>(); for (int x = 0; x < iCnt; x++) { threadStatistic th = new threadStatistic(buf, ref offset); thList.Add(th); } this.ThreadStatList = thList; this.remoteIP = "0.0.0.0"; //unknown return(this); }
public process_statistics FromByte(byte[] buf) { int offset = 0; Int16 bLen = BitConverter.ToInt16(buf, 0); //2 bytes offset += sizeof(System.Int16); if (bLen > 0) this.sName = System.Text.Encoding.UTF8.GetString(buf, offset, bLen); offset += bLen; this.dateTime = BitConverter.ToInt64(buf, offset); offset += sizeof(System.Int64); this.duration = BitConverter.ToUInt32(buf, offset); offset += sizeof(System.Int32); this.procUsage = new process_usage(ref buf, ref offset); //offset = offset; //has been changed by process_usage this.processID = BitConverter.ToUInt32(buf, offset); offset += sizeof(System.UInt32); //how many thtreads are in the byte stream Int16 iCnt = BitConverter.ToInt16(buf, offset); offset += sizeof(System.Int16); //start reading the threads List<threadStatistic> thList = new List<threadStatistic>(); for (int x = 0; x < iCnt; x++) { threadStatistic th = new threadStatistic(buf, ref offset); thList.Add(th); } this.ThreadStatList = thList; this.remoteIP = "0.0.0.0"; //unknown return this; }
public process_statistics(uint uProcessID, string s, process_usage u, long dt, uint du, List<threadStatistic> threadList, string sRemoteIP) { sName = s; processID = uProcessID; procUsage = u; dateTime = dt; duration = du; ThreadStatList = threadList; remoteIP = sRemoteIP; }