/// <summary> /// Read measures from jtl to clean line format: ts= lb=|x| t= na= s= /// </summary> /// <param name="jtlFileName"></param> private string[] ReadMeasureDataText(string jtlFileName) { Log.WriteLine(string.Format("read measure data (as text) from {0}...", jtlFileName)); //string[] inLines = ReadLinesFromFile(jtlFileName, "ample t="); // gevaarlijk (volgorde), TODO string[] inLines = ReadLinesFromFile(jtlFileName, JmeterLineRaw.SamplePattern); List <string> outLines = new List <string>(); // TODO dit is erg gevoelig, IES struikelt hierover. beter checks op aanwezigheid attributes anders doen // zodat ontbreken van tags en volgorde niet belangrijk zijn //Regex regex = new Regex("t=\"(\\d+)\".+ts=\"(\\d+)\".+s=\"(\\w+)\".+lb=\"(.+)\".rc.+na=\"(\\d+)\""); int cnt = 0; foreach (string line in inLines) { if (JmeterLineRaw.IsUsableLine(line)) { cnt++; if (cnt < 10) { Log.WriteLine("first 10 input: " + line); } Dictionary <string, string> attributes = JmeterLineRaw.GetSampleAttributes(line); string outLine = string.Format("ts={0} t={1} na={2} s={3} lb={4}", attributes["ts"], attributes["t"], attributes["na"], attributes["s"], attributes["lb"]); outLines.Add(outLine); if (cnt < 10) { Log.WriteLine("1st 10 extraction: " + outLine); } } else { Log.WriteLine("WARNING useless jtl line skipped: " + line); } } Log.WriteLine(string.Format("{0} lines out of {1} selected for evaluation", outLines.Count, inLines.Length)); return(outLines.ToArray()); }
/// <summary> /// Overload ReadLinesFromFile, but filter JTL lines on validity /// </summary> /// <param name="fileName"></param> /// <returns></returns> public string[] ReadLinesFromFileJTL(string fileName) { string[] orgLines = ReadLinesFromFile(fileName); Log.WriteLine("filter only usable JTL lines..."); List <string> validLines = new List <string>(); foreach (string orgLine in orgLines) { if (JmeterLineRaw.IsUsableLine(orgLine)) { validLines.Add(orgLine); } } return(validLines.ToArray()); }