예제 #1
0
        // common method to generate the header that gets written to the tsv file for perfmon
        public string GetHeader(OutHeader outHeader)
        {
            string splitPattern = "\\s+";
            Regex  rgx          = new Regex(splitPattern);

            string[]      outHeaderSplit = rgx.Split(outHeader.FileContents[outHeader.StartingRow]);
            StringBuilder header         = new StringBuilder();

            header.Append('"' + "(PDH-TSV 4.0) (Pacific Daylight Time)(420)" + '"' + "\t");

            // for the out files that have devices, we need to include the devices as part of the header
            if (outHeader.Devices != null)
            {
                foreach (string device in outHeader.Devices)
                {
                    for (int i = outHeader.StartingColumn; i < outHeaderSplit.Length - outHeader.TrimColumn; i++)
                    {
                        header.Append('"' + "\\\\" + ConfigValues.MachineName + "\\" + outHeader.ObjectName + "(" + device + ")\\" + outHeaderSplit[i] + '"' + "\t");
                    }
                }
            }

            // some out files do not have devices, like mem free or mem swap. we look for devices count and if there are none, create header w/o devices
            if (outHeader.Devices == null)
            {
                for (int i = outHeader.StartingColumn; i < outHeaderSplit.Length - outHeader.TrimColumn; i++)
                {
                    header.Append('"' + "\\\\" + ConfigValues.MachineName + "\\" + outHeader.ObjectName + "\\" + outHeaderSplit[i] + '"' + "\t");
                }
            }

            return(header.ToString());
        }
예제 #2
0
        // class methods
        private string GetMemSwapHeader()
        {
            // creating the outheader object and passing in variables on where to start parsing specific strings
            OutHeader outHeader = new OutHeader()
            {
                StartingColumn = 2,
                StartingRow    = 2,
                FileContents   = FileContents,
                ObjectName     = "Memory Swap"
            };

            return(new LinuxOutFileHelper().GetHeader(outHeader));
        }
예제 #3
0
        private string GetNetHeader()
        {
            OutHeader outHeader = new OutHeader()
            {
                StartingColumn = 3,
                StartingRow    = 2,
                FileContents   = FileContents,
                Devices        = Devices,
                ObjectName     = "Network Interface"
            };

            return(new LinuxOutFileHelper().GetHeader(outHeader));
        }
예제 #4
0
        // get the header that will be written to the tsv file
        private string GetMpStatHeader()
        {
            OutHeader outHeader = new OutHeader()
            {
                StartingColumn = 3,
                StartingRow    = 2,
                FileContents   = FileContents,
                Devices        = Devices,
                ObjectName     = "Processor"
            };

            return(new LinuxOutFileHelper().GetHeader(outHeader));
        }
예제 #5
0
        // generates the header that gets written to the TSV file
        private string GetIoStatHeader()
        {
            // creating the outheader object and passing in variables on where to start parsing specific strings
            OutHeader outHeader = new OutHeader()
            {
                StartingColumn = 1,
                StartingRow    = FileContents.FindIndex(l => l.StartsWith("Device")), //3
                FileContents   = FileContents,
                Devices        = Devices,
                ObjectName     = "Logicaldisk"
            };

            return(new LinuxOutFileHelper().GetHeader(outHeader));
        }
예제 #6
0
        // now that we have the unique pids, we can create the header
        private string GetPidStatHeader()
        {
            // creating the outheader object and passing in variables on where to start parsing specific strings
            OutHeader outHeader = new OutHeader()
            {
                StartingColumn = 4,
                TrimColumn     = 1,
                StartingRow    = 2,
                FileContents   = FileContents,
                Devices        = UniquePids.Select(x => x.Value + "#" + x.Key).ToList(),
                ObjectName     = "Process"
            };

            return(new LinuxOutFileHelper().GetHeader(outHeader));
        }