/usr/bin/likwid-perfscope is in likwid 3.1.3+dfsg1-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | #!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
sub usage #<#
{
print <<END;
usage: $0 --group <Performance Group> --cores <physical core list>
Required:
-cores <CORELIST> : list of physical cores
Optional:
-h : this (help) message
-freq : frequency of updates, in ms or s (e.g. 500ms), default: 1s
-group <PERFGROUP> : Specify what to plot, default FLOPS_DP
Example:
$0 -group FLOPS_DP -cores 0-3
END
exit(0);
}
#>#
my $CONFIG = { #<#
"FLOPS_DP" => {
"group" => 'FLOPS_DP',
"expr" => 'DP MFlops/s',
"title" => 'Double Precision Flop Rate',
"yaxis" => 'MFlops/s'},
"FLOPS_SP" => {
"group" => 'FLOPS_SP',
"expr" => 'SP MFlops/s',
"title" => 'Single Precision Flop Rate',
"yaxis" => 'MFlops/s'},
"L2" => {
"group" => 'L2',
"expr" => 'L2 bandwidth [MBytes/s]',
"title" => 'L2 cache bandwidth',
"yaxis" => 'bandwidth [MB/s]'},
"L3" => {
"group" => 'L3',
"expr" => 'L3 bandwidth [MBytes/s]',
"title" => 'L3 cache bandwidth',
"yaxis" => 'bandwidth [MB/s]'},
"CLOCK" => {
"group" => 'CLOCK',
"expr" => 'Clock [MHz]',
"title" => 'Clock rate',
"yaxis" => 'MHz'},
"NUMA" => {
"group" => 'MEM',
"expr" => 'Remote BW [MBytes/s]',
"title" => 'Remote NUMA bandwidth',
"yaxis" => 'bandwidth [MB/s]'},
"MEM" => {
"group" => 'MEM',
"expr" => 'MBytes/s',
"title" => 'Main memory bandwidth',
"yaxis" => 'bandwidth [MB/s]'}};
#>#
my $FREQ = '1s';
my $CORES = '';
my $optGroup = 'FLOPS_DP';
my $optPlot;
GetOptions ('group=s' => \$optGroup, 'freq=s' => \$FREQ, 'cores=s' => \$CORES, 'plot=s' => \$optPlot, 'help' => \&usage);
my $GROUP = $CONFIG->{$optGroup}->{'group'};
my $yaxis = $CONFIG->{$optGroup}->{'yaxis'};
my $title = $CONFIG->{$optGroup}->{'title'};
my $expr = $CONFIG->{$optGroup}->{'expr'};
my $legend = '';
open (INPUT, "likwid-perfctr -g $GROUP -d $FREQ -c $CORES |");
select((select(INPUT), $| = 1)[0]);
while (<INPUT>) {
if (/CORES: ([0-9 ]+)/) {
my @cores = split ' ',$1;
my $coreNumber = 0;
foreach my $core (@cores) {
$legend .= " --legend $coreNumber=\"core $core\" ";
$coreNumber++;
}
last;
}
}
open (OUTPUT, "| feedGnuplot --lines --domain --stream --xlabel \"seconds\" --ylabel \"$yaxis\" --title \"$title\" $legend");
select((select(OUTPUT), $| = 1)[0]);
while (<INPUT>) {
if (/$expr/) {
s/$expr//;
print OUTPUT;
}
}
close(INPUT);
close(OUTPUT);
# vim: foldmethod=marker foldmarker=#<#,#>#
|