/usr/share/likwid/xml 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 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | #!/usr/bin/perl -w
use strict;
use warnings;
my $FILTERTYPE = 'xml';
my $NL = "\n";
if ($#ARGV < 1) {
die "Filter failed! Please report bug.\n";
}
my $filename = $ARGV[0];
my $fileType = $ARGV[1];
my $infile = $filename;
open INFILE,"< $filename";
$filename =~ s/\.tmp/\.$FILTERTYPE/;
open OUTFILE,"> $filename";
if ($fileType eq 'topology') {
my $region = 'topo';
my $indomain = 0;
print OUTFILE '<node>'.$NL;
while (<INFILE>) {
if (/Cache Topology/) {
$region = 'cache';
print OUTFILE '<caches>'.$NL;
} elsif (/NUMA Topology/) {
print OUTFILE '</caches>'.$NL;
print OUTFILE '<numa>'.$NL;
$region = 'numa';
}
if ($region eq 'topo') {
if (/(CPU type):\t([\w ]*)/) {
print OUTFILE '<cpu>'.$2.'</cpu>'.$NL;
} elsif (/CPU clock:\t([\d.]) GHz/) {
print OUTFILE '<clock>'.$1.'</clock>'.$NL;
} elsif (/(Sockets):\t(\d*)/) {
print OUTFILE '<socketsPerNode>'.$2.'</socketsPerNode>'.$NL;
} elsif (/(Cores per socket):\t(\d*)/) {
print OUTFILE '<coresPerSocket>'.$2.'</coresPerSocket>'.$NL;
} elsif (/(Threads per core):\t(\d*)/) {
print OUTFILE '<threadsPerCore>'.$2.'</threadsPerCore>'.$NL;
} elsif (/([0-9]*)\t\t([0-9]*)\t\t([0-9]*)\t\t([0-9]*)/) {
#TODO Build tree for XML output from table!
}
} elsif ($region eq 'cache') {
if (/(Size):\t([0-9]*) ([kMB]*)/) {
my $size = $2;
if ($3 eq 'MB') {
$size *= 1024;
}
print OUTFILE '<size>'.$size.'</size>'.$NL;
} elsif (/(Cache groups):\t*(.*)/) {
print OUTFILE '</cache>'.$NL;
} elsif (/(Associativity):\t*(.*)/) {
print OUTFILE '<associativity>'.$2.'</associativity>'.$NL;
} elsif (/(Number of sets):\t*(.*)/) {
print OUTFILE '<sets>'.$2.'</sets>'.$NL;
} elsif (/(Cache line size):\t*(.*)/) {
print OUTFILE '<linesize>'.$2.'</linesize>'.$NL;
} elsif (/(Level):\t*(.*)/) {
print OUTFILE '<cache>'.$NL;
print OUTFILE '<level>'.$2.'</level>'.$NL;
}
} elsif ($region eq 'numa') {
if (/Domain ([0-9]*)/) {
if ($indomain )
{
print OUTFILE '</domain>'.$NL;
}
print OUTFILE '<domain>'.$NL;
print OUTFILE '<id>'.$1.'</id>'.$NL;
$indomain = 1
} elsif (/Memory: ([0-9.]+) MB free of total ([0-9.]+) MB/) {
print OUTFILE '<freememory>'.$1.'</freememory>'.$NL;
print OUTFILE '<totalmemory>'.$2.'</totalmemory>'.$NL;
} elsif (/Processors:[ ]+([0-9. ]+)/) {
print OUTFILE '<processors>'.$1.'</processors>'.$NL;
}
}
}
if ($indomain)
{
print OUTFILE '</domain>'.$NL;
}
print OUTFILE '</numa>'.$NL;
print OUTFILE '</node>'.$NL;
} elsif ($fileType eq 'perfctr') {
my $header = 0;
my @col;
print OUTFILE '<perfctr>'.$NL;
while (<INFILE>) {
if (/Event[ ]*\|[ ]*(core.*)\|/) {
if (not $header) {
@col = split('\|',$1);
foreach (@col) {
s/core //g;
s/[ ]//g;
}
$header = 1;
}
}elsif (/STAT/) {
}elsif (/\|[ ]+([A-Z0-9_]+)[ ]+\|[ ]*(.*)\|/) {
my @rescol = split('\|',$2);
my $id = 0;
print OUTFILE '<result>'.$NL;
print OUTFILE '<event>'.$1.'</event>'.$NL;
foreach (@rescol) {
s/[ ]//g;
print OUTFILE '<core>'.$NL;
print OUTFILE '<id>'.$col[$id].'</id>'.$NL;
print OUTFILE '<value>'.$_.'</value>'.$NL;
print OUTFILE '</core>'.$NL;
$id++;
}
print OUTFILE '</result>'.$NL;
}
}
print OUTFILE '</perfctr>'.$NL;
} else {
die "Filter failed! Unknown application type $fileType!\n";
}
#unlink($infile);
close INFILE;
close OUTFILE;
|