Wednesday, February 17, 2016

another cmdline example to avoid script


Below are the list of perf numbers for different configurations. I want to collect the numbers for 1 interface, ncb_dly 0 and sort the numbers for different pkt sizes.  Just yet another example of egrep-awk-sort together.

[tgunasekaran@cahw-vnc7 ]$ egrep "# of INTF: 1" perf_metrics_overall.csv 
# of INTF: 1, NCB_DLY: 0, PKT_SZ:  1024, # of CQ: 1, 116.302435 , 14.197075
# of INTF: 1, NCB_DLY: 300, PKT_SZ:  1024, # of CQ: 1, 115.146584 , 14.056803
# of INTF: 1, NCB_DLY: 0, PKT_SZ:  128, # of CQ: 1, 79.477399 , 77.614647
# of INTF: 1, NCB_DLY: 300, PKT_SZ:  128, # of CQ: 1, 79.264892 , 77.407122
# of INTF: 1, NCB_DLY: 0, PKT_SZ:  1536, # of CQ: 1, 119.433400 , 9.720648
# of INTF: 1, NCB_DLY: 300, PKT_SZ:  1536, # of CQ: 1, 119.390089 , 9.715990
# of INTF: 1, NCB_DLY: 0, PKT_SZ:  2048, # of CQ: 1, 116.241915 , 7.095024
# of INTF: 1, NCB_DLY: 300, PKT_SZ:  2048, # of CQ: 1, 115.647429 , 7.061334
# of INTF: 1, NCB_DLY: 0, PKT_SZ:  256, # of CQ: 1, 97.043759 , 47.422623
# of INTF: 1, NCB_DLY: 300, PKT_SZ:  256, # of CQ: 1, 97.059819 , 47.392490
# of INTF: 1, NCB_DLY: 0, PKT_SZ:  4096, # of CQ: 1, 122.165888 , 3.728207
# of INTF: 1, NCB_DLY: 300, PKT_SZ:  4096, # of CQ: 1, 121.941492 , 3.721359
# of INTF: 1, NCB_DLY: 0, PKT_SZ:  512, # of CQ: 1, 109.078867 , 26.695706
# of INTF: 1, NCB_DLY: 300, PKT_SZ:  512, # of CQ: 1, 109.205821 , 26.661578
# of INTF: 1, NCB_DLY: 0, PKT_SZ:  64, # of CQ: 1, 46.763638 , 91.335230
# of INTF: 1, NCB_DLY: 300, PKT_SZ:  64, # of CQ: 1, 46.447426 , 90.717629
# of INTF: 1, NCB_DLY: 0, PKT_SZ:  8192, # of CQ: 1, 123.508163 , 1.884585
# of INTF: 1, NCB_DLY: 300, PKT_SZ:  8192, # of CQ: 1, 123.555021 , 1.885326

[tgunasekaran@cahw-vnc7 ]$ egrep "# of INTF: 1" perf_metrics_overall.csv | egrep "NCB_DLY: 0" 
# of INTF: 1, NCB_DLY: 0, PKT_SZ:  1024, # of CQ: 1, 116.302435 , 14.197075
# of INTF: 1, NCB_DLY: 0, PKT_SZ:  128, # of CQ: 1, 79.477399 , 77.614647
# of INTF: 1, NCB_DLY: 0, PKT_SZ:  1536, # of CQ: 1, 119.433400 , 9.720648
# of INTF: 1, NCB_DLY: 0, PKT_SZ:  2048, # of CQ: 1, 116.241915 , 7.095024
# of INTF: 1, NCB_DLY: 0, PKT_SZ:  256, # of CQ: 1, 97.043759 , 47.422623
# of INTF: 1, NCB_DLY: 0, PKT_SZ:  4096, # of CQ: 1, 122.165888 , 3.728207
# of INTF: 1, NCB_DLY: 0, PKT_SZ:  512, # of CQ: 1, 109.078867 , 26.695706
# of INTF: 1, NCB_DLY: 0, PKT_SZ:  64, # of CQ: 1, 46.763638 , 91.335230
# of INTF: 1, NCB_DLY: 0, PKT_SZ:  8192, # of CQ: 1, 123.508163 , 1.884585


[tgunasekaran@cahw-vnc7 ]$ egrep "# of INTF: 1" perf_metrics_overall.csv | egrep "NCB_DLY: 0" | awk '{print $8,$13,$15}'
1024, 116.302435 14.197075
128, 79.477399 77.614647
1536, 119.433400 9.720648
2048, 116.241915 7.095024
256, 97.043759 47.422623
4096, 122.165888 3.728207
512, 109.078867 26.695706
64, 46.763638 91.335230
8192, 123.508163 1.884585

[tgunasekaran@cahw-vnc7 ]$ egrep "# of INTF: 1" perf_metrics_overall.csv | egrep "NCB_DLY: 0" | awk '{print $8,$13,$14,$15}' | sort -n
64, 46.763638 , 91.335230
128, 79.477399 , 77.614647
256, 97.043759 , 47.422623
512, 109.078867 , 26.695706
1024, 116.302435 , 14.197075
1536, 119.433400 , 9.720648
2048, 116.241915 , 7.095024
4096, 122.165888 , 3.728207
8192, 123.508163 , 1.884585

sort -n will perform numerical sort.
awk will capture the arguments with space as delimiter.


No comments:

Post a Comment