brendangregg/pmc-cloud-tools

Scripts break due to locales

martinvonwittich opened this issue · 0 comments

For example with de_DE.UTF-8, tlbstat is obviously reporting incorrect data like 0 cycles/instructions:

server ~/pmc-cloud-tools # locale
LANG=de_DE.UTF-8
LANGUAGE=
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=
server ~/pmc-cloud-tools # ./tlbstat 
K_CYCLES   K_INSTR      IPC DTLB_WALKS ITLB_WALKS K_DTLBCYC  K_ITLBCYC  DTLB% ITLB%
0          0           0.54 169        991        0          0          9092.34 621.05
0          0           0.60 156        739        0          0          13143.51 893.67
0          0           0.59 239        1          0          0          7564.99 648.94
^C

Setting LC_ALL=C fixes this:

server ~/pmc-cloud-tools # LC_ALL=C ./tlbstat
K_CYCLES   K_INSTR      IPC DTLB_WALKS ITLB_WALKS K_DTLBCYC  K_ITLBCYC  DTLB% ITLB%
2887484    1273377     0.44 7802665    493256     372235     16075      12.89  0.56
2951093    1423201     0.48 7694503    480076     360379     16713      12.21  0.57
3827055    2904295     0.76 8061665    689602     394809     22796      10.32  0.60
2925424    1297466     0.44 7594530    557178     361611     17717      12.36  0.61
^C