public string resolvePath(string filename) { // account for relative naming schemes from 3rd party softwares if (filename.StartsWith("//")) { filename = filename.Substring(2); } UI.printDetailed(UI.Module.SYS, "Resolving {0} path \"{1}\" ...", type, filename); return(Path.GetFullPath(filename));//fixme: check to see if this is relevant //File f = new File(filename); //if (!f.isAbsolute()) //{ // foreach (string prefix in searchPath) // { // UI.printDetailed(UI.Module.SYS, " * searching: \"{0]\" ...", prefix); // if (prefix.EndsWith(Path.DirectorySeparatorChar.ToString()) || filename.StartsWith(Path.DirectorySeparatorChar.ToString())) // f = new File(prefix + filename); // else // f = new File(prefix + File.separator + filename); // if (f.exists()) // { // // suggested path exists - try it // return f.getAbsolutePath(); // } // } //} //// file was not found in the search paths - return the filename itself //return filename; }
public void execute(BenchmarkTest test) { // clear previous results for (int i = 0; i < timers.Length; i++) { timers[i] = null; } // loop for the specified number of iterations or until the time limit long startTime = NanoTime.Now; for (int i = 0; i < timers.Length && ((NanoTime.Now - startTime) / 1000000000) < timeLimit; i++) { UI.printInfo(UI.Module.BENCH, "Running iteration {0}", (i + 1)); timers[i] = new Timer(); test.kernelBegin(); timers[i].start(); test.kernelMain(); timers[i].end(); test.kernelEnd(); } // report stats double avg = 0; double min = double.PositiveInfinity; double max = double.NegativeInfinity; int n = 0; foreach (Timer t in timers) { if (t == null) { break; } double s = t.seconds(); min = Math.Min(min, s); max = Math.Max(max, s); avg += s; n++; } if (n == 0) { return; } avg /= n; double stdDev = 0; foreach (Timer t in timers) { if (t == null) { break; } double s = t.seconds(); stdDev += (s - avg) * (s - avg); } stdDev = Math.Sqrt(stdDev / n); UI.printInfo(UI.Module.BENCH, "Benchmark results:"); UI.printInfo(UI.Module.BENCH, " * Iterations: {0}", n); UI.printInfo(UI.Module.BENCH, " * Average: {0}", Timer.tostring(avg)); UI.printInfo(UI.Module.BENCH, " * Fastest: {0}", Timer.tostring(min)); UI.printInfo(UI.Module.BENCH, " * Longest: {0}", Timer.tostring(max)); UI.printInfo(UI.Module.BENCH, " * Deviation: {0}", Timer.tostring(stdDev)); for (int i = 0; i < timers.Length && timers[i] != null; i++) { UI.printDetailed(UI.Module.BENCH, " * Iteration {0}: {1}", i + 1, timers[i]); } }