我当前正在基准一些C 代码。可悲的是,基准工具只会在终端上打印一个字符串(我必须使用此基准工具,因此请勿建议新的基准工具)。
看起来像这样的行:
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
Blitz2D, 0.00, 198423.00, 439478.00, 615.00, 3.00, 958.00, 39157.00, 1, 2.21, 1.14, 5.07
我现在正在做的是: ./a.out > some.txt
。
每个新测试都有自己的新系列,每个独立的测试块(基本上是相同的测试,但使用更改的测试参数)都被我选择的特殊字符分开。
从该文件中获取某些信息的最佳方法是什么?最好的是,第二行中的每个数字作为一个索引...
我该怎么做?请记住,我从字面上不知道Python,Bash,Regex等。最好...)
编辑:最后,我需要在不同种类的图形图中进行此信息...因此,最适合此的格式都是完美的
这是一个完整的测试块:
§
Testing with MxK * KxM Matrices - M: 29 - K: 67
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
Fastor2D, 0.00, 77568.00, 140312.00, 780.00, 206.00, 161.00, 15781.00, 1, 1.81, 1.45, 4.92
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
Fastor2D, 0.00, 76681.00, 140312.00, 802.00, 39.00, 130.00, 15571.00, 1, 1.83, 1.44, 4.92
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
Fastor2D, 0.00, 77174.00, 140312.00, 788.00, 31.00, 135.00, 15718.00, 1, 1.82, 1.45, 4.91
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
Fastor2D, 0.00, 76720.00, 140312.00, 781.00, 30.00, 134.00, 15616.00, 1, 1.83, 1.44, 4.91
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
Fastor2D, 0.00, 77052.00, 140312.00, 781.00, 16.00, 127.00, 15526.00, 1, 1.82, 1.43, 4.96
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
Eigen2D, 0.00, 3507208.00, 2477793.00, 129053.00, 999.00, 898.00, 724590.00, 1, 0.71, 1.01, 4.84
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
Eigen2D, 0.00, 3554544.00, 2477793.00, 128932.00, 37.00, 787.00, 734337.00, 1, 0.70, 1.01, 4.84
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
Eigen2D, 0.00, 3517898.00, 2477793.00, 128931.00, 25.00, 734.00, 726840.00, 1, 0.70, 1.01, 4.84
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
Eigen2D, 0.00, 3537674.00, 2483174.00, 129548.00, 683.00, 761.00, 730925.00, 1, 0.70, 1.01, 4.84
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
Eigen2D, 0.00, 3527303.00, 2481152.00, 129326.00, 190.00, 741.00, 728567.00, 1, 0.70, 1.01, 4.84
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
XTensor2D, 0.00, 60718.00, 78733.00, 3363.00, 434.00, 206.00, 12772.00, 1, 1.30, 1.72, 4.75
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
XTensor2D, 0.00, 56300.00, 78733.00, 3335.00, 32.00, 146.00, 11445.00, 1, 1.40, 1.79, 4.92
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
XTensor2D, 0.00, 55279.00, 78733.00, 3340.00, 39.00, 121.00, 11305.00, 1, 1.42, 1.79, 4.89
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
XTensor2D, 0.00, 55294.00, 78733.00, 3344.00, 22.00, 114.00, 11297.00, 1, 1.42, 1.79, 4.89
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
XTensor2D, 0.00, 54857.00, 78733.00, 3322.00, 6.00, 108.00, 11233.00, 1, 1.44, 1.80, 4.88
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
Blitz2D, 0.00, 198423.00, 439478.00, 615.00, 3.00, 958.00, 39157.00, 1, 2.21, 1.14, 5.07
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
Blitz2D, 0.00, 190556.00, 439478.00, 584.00, 2.00, 964.00, 39058.00, 1, 2.31, 1.14, 4.88
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
Blitz2D, 0.00, 190088.00, 439478.00, 581.00, 8.00, 948.00, 39057.00, 1, 2.31, 1.14, 4.87
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
Blitz2D, 0.00, 190177.00, 439478.00, 594.00, 11.00, 941.00, 38989.00, 1, 2.31, 1.14, 4.88
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
Blitz2D, 0.00, 190099.00, 439478.00, 584.00, 7.00, 943.00, 39030.00, 1, 2.31, 1.14, 4.87
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
FTensor2D, 0.00, 24970.00, 17695.00, 96.00, 19.00, 101.00, 4851.00, 1, 0.71, 29.76, 5.15
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
FTensor2D, 0.00, 24619.00, 17695.00, 85.00, 8.00, 94.00, 4738.00, 1, 0.72, 48.35, 5.20
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
FTensor2D, 0.00, 24471.00, 17695.00, 68.00, 2.00, 94.00, 4739.00, 1, 0.72, 48.36, 5.16
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
FTensor2D, 0.00, 24454.00, 17695.00, 74.00, 4.00, 93.00, 4727.00, 1, 0.72, 43.77, 5.17
name, time, cycle, instr, L1-miss, LLC-miss, br-miss, task, scale, IPC, CPU, GHz
FTensor2D, 0.00, 24318.00, 17695.00, 83.00, 16.00, 93.00, 4703.00, 1, 0.73, 54.69, 5.17
§
在您的编辑中,您可以grep" 2d"> data.txt仅获取数据,然后在计算中打开该数据。2D在您的所有名称列中,因此它很容易使用。
# run benchmarking
./a.out > some.txt
# Extract data from some.txt
grep "2D" some.txt > data.csv
# Open with libreoffice calc and plot
libreoffice data.csv
另外,您可以使用命令行绘图工具(例如gnuplot)来绘制data.txt。您也可以更具体地使用GREP命令来提取特定数据。