Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
df2d653
fix the crash when IIOPMU is not initialized
rdementi Nov 27, 2020
e76f21d
pcm-raw: fix the name of the utility
rdementi Nov 27, 2020
bc851fe
zero fixed counters if perf API is not used
rdementi Nov 30, 2020
e209a00
implement overflow correction logic for core events
rdementi Dec 1, 2020
bd5093d
use full value if retrieved using perf API
rdementi Dec 1, 2020
959caaf
Merge remote-tracking branch 'opcm-github/master'
rdementi Dec 2, 2020
7d000fc
fix pmu-query.py on Windows
rdementi Dec 2, 2020
04fd9be
don't ignore txt files
rdementi Dec 2, 2020
b919a89
print the number of LLC slides per socket
rdementi Dec 5, 2020
e4d2f26
update the winpmem driver URL
rdementi Dec 9, 2020
ea0e5d3
add (disabled) MSR write tracing on Linux
rdementi Dec 17, 2020
1a9ddf9
print info about perf uncore support
rdementi Dec 17, 2020
dd6bfa5
execute the body of useLinuxPerfForUncore just once
rdementi Dec 17, 2020
aa20a13
Merge remote-tracking branch 'opcm-github/master'
rdementi Dec 17, 2020
5a5e6a2
allow MBM on CLX and CPX
rdementi Dec 21, 2020
f75a4f5
drop 'nice' Makefile target
rdementi Dec 21, 2020
4d15bf8
support resctl (draft)
rdementi Dec 21, 2020
9a55ac8
open/close resctrl file for each read
rdementi Dec 21, 2020
917724b
address g++10 warnings
rdementi Dec 21, 2020
f0fbeff
Merge branch 'tmp3'
rdementi Dec 21, 2020
059f6cb
refactor: get rid of unions for core event structure
rdementi Dec 22, 2020
6af48d6
resctrl: be more verbose in case of file read error
rdementi Dec 22, 2020
d677c2a
use fewer magic constants
rdementi Dec 23, 2020
42a4f6b
address a Klocwork warning
rdementi Dec 23, 2020
17283bf
address Klocwork warnings (II)
rdementi Dec 23, 2020
ae61d39
add g++9 and g++10 to gitlab CI
rdementi Dec 23, 2020
fb159f2
don't try to install g++-4.8 for groovy and focal
rdementi Dec 23, 2020
1a25c9c
don't hardcode the compiler
rdementi Dec 30, 2020
eadbf9f
daemon/client: fix error checking
rdementi Dec 30, 2020
ec5c903
address clang scan warning
rdementi Dec 30, 2020
d2bb303
address clang scan warning
rdementi Dec 30, 2020
8dde1fd
pcm-memory: don't use KNL ID directly
rdementi Dec 30, 2020
e888053
address clang scan warning
rdementi Dec 30, 2020
0dbcf49
address clang scan warning
rdementi Dec 30, 2020
fee35fc
add clang scan build
rdementi Dec 30, 2020
c7ba4a4
Merge branch 'add-clang-scan-build' into 'master'
rdementi Dec 30, 2020
93ca579
address clang static analyzer warning
rdementi Dec 30, 2020
2f0ef08
address clang scan warnings
rdementi Dec 30, 2020
98452e0
address cppcheck warning
rdementi Jan 1, 2021
2b2438c
add cppcheck to CI
rdementi Jan 1, 2021
e83ffb1
cppcheck: ignore C# project PCM-Service_Win
rdementi Jan 1, 2021
e90946c
cppcheck: use 28 threads
rdementi Jan 1, 2021
a89f8a4
Merge remote-tracking branch 'origin/cppcheck_ci'
rdementi Jan 1, 2021
b7d1c51
address cppcheck warnings
rdementi Jan 1, 2021
839b5fc
cppcheck: fix silent strerror call
rdementi Jan 1, 2021
1a2c31d
address cppcheck warnings
rdementi Jan 1, 2021
a2085c0
address cppcheck warning
rdementi Jan 1, 2021
23722ab
cppcheck: ignore realtime.cpp
rdementi Jan 1, 2021
4335e09
cppcheck: enable 'warning' checks
rdementi Jan 1, 2021
a71785e
daemon: fix client build on older compilers
rdementi Jan 2, 2021
be8a985
cppcheck: fix a few warnings
rdementi Jan 2, 2021
c5f27ef
cppcheck: include realtime.cpp again and fix a few warnings
rdementi Jan 2, 2021
2cbad23
add compilation on windows with MSVC to CI
rdementi Jan 4, 2021
40e8362
Merge branch 'windows_ci' into 'master'
rdementi Jan 4, 2021
6705b2a
Merge remote-tracking branch 'opcm-github/master'
rdementi Jan 4, 2021
381a753
refactor SKL code path
rdementi Jan 15, 2021
6079d11
ICL is 5-way
rdementi Jan 15, 2021
804bc3d
properly detect codename for Skylake U/Y, Whiskey and Comet Lake
rdementi Jan 15, 2021
aed1973
support Tiger Lake (TGL)
rdementi Jan 18, 2021
31be790
Merge remote-tracking branch 'opcm-github/master'
rdementi Jan 18, 2021
3663129
fix max IPC for TGL
rdementi Jan 18, 2021
be2dbfb
support using Linux perf API for core PMU for systems with offlined c…
rdementi Jan 28, 2021
91100a8
Makefile: add CFLAGS and refactor CXXFLAGS to append to it
harry-van-haaren Jan 28, 2021
2ceb1fa
c_example: fix rdtscp returning out of bounds CPU
harry-van-haaren Jan 28, 2021
534be46
c_example: fix warnings, improve output for beginner user
harry-van-haaren Jan 28, 2021
45de0dd
Merge branch 'hvanhaar_c_example' into 'master'
rdementi Jan 28, 2021
981784b
add additional CML model
rdementi Jan 29, 2021
e01eec4
add additional ICL model
rdementi Jan 29, 2021
290d887
add additional TGL model
rdementi Jan 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*.htm
*.html
*.dll
*.txt
*.patch
*.orig
*.out
Expand Down
43 changes: 43 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,49 @@ build_linux:gcc5:
- g++ --version
- make -j

build_linux:gcc10:
image: "ubuntu:groovy"
stage: build
before_script:
- apt-get update -qq && apt-get install -qq -y make g++
script:
- g++ --version
- make -j

build_linux:clang_scan:
image: "ubuntu:groovy"
stage: build
before_script:
- apt-get update -qq && apt-get install -qq -y make clang clang-tools perl g++
script:
- scan-build --status-bugs make -j

build_windows:
stage: build
before_script:
- 'call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"'
script:
- 'msbuild pcm-all.sln /p:Configuration=Release;Platform=x64 /t:Clean,Build /m'
tags:
- windows

cppcheck:
image: "ubuntu:groovy"
stage: build
before_script:
- apt-get update -qq && apt-get install -qq -y cppcheck
script:
- sh cppcheck.sh . 28

build_linux:gcc9:
image: "ubuntu:focal"
stage: build
before_script:
- apt-get update -qq && apt-get install -qq -y make g++
script:
- g++ --version
- make -j

build_linux:gcc7:
image: "ubuntu:bionic"
stage: build
Expand Down
2 changes: 2 additions & 0 deletions ENVVAR_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
`PCM_USE_UNCORE_PERF=1` : use Linux perf events API to program *uncore* PMUs (default is *not* to use it)

`PCM_NO_RDT=1` : don't use RDT metrics for a better interoperation with pqos utility (https://github.com/intel/intel-cmt-cat)

`PCM_USE_RESCTRL=1` : use Linux resctrl driver for RDT metrics
14 changes: 6 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ ifeq ($(UNAME), Linux)
EXE += daemon-binaries
endif

CXXFLAGS += -Wall -g -O3 -Wno-unknown-pragmas -std=c++11 -fPIC
CFLAGS += -Wall -g -O3 -Wno-unknown-pragmas -fPIC
CXXFLAGS += $(CFLAGS) -std=c++11

# uncomment if your Linux kernel supports access to /dev/mem from user space
# CXXFLAGS += -DPCM_USE_PCI_MM_LINUX
Expand Down Expand Up @@ -50,7 +51,7 @@ CXX=c++
LIB= -lpthread -lc++
endif

COMMON_OBJS = msr.o cpucounters.o pci.o mmio.o client_bw.o utils.o topology.o dashboard.o debug.o threadpool.o
COMMON_OBJS = msr.o cpucounters.o pci.o mmio.o client_bw.o utils.o topology.o dashboard.o debug.o threadpool.o resctrl.o
EXE_OBJS = $(EXE:.x=.o)
OBJS = $(COMMON_OBJS) $(EXE_OBJS)

Expand Down Expand Up @@ -83,10 +84,10 @@ libpcm.so: $(COMMON_OBJS) pcm-core.o
$(CXX) $(LDFLAGS) $(CXXFLAGS) -DPCM_SILENT -shared $^ $(LIB) -o $@

c_example.x: c_example.c libpcm.so
$(CC) -DPCM_DYNAMIC_LIB $< -ldl -Wl,-rpath,$(shell pwd) -o $@
$(CC) $(CFLAGS) -DPCM_DYNAMIC_LIB $< -ldl -Wl,-rpath,$(shell pwd) -o $@

c_example_shlib.x: c_example.c libpcm.so
$(CC) $< -L./ -Wl,-rpath,$(shell pwd) -lpcm -o $@
$(CC) $(CFLAGS) $< -L./ -Wl,-rpath,$(shell pwd) -lpcm -o $@

%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $*.cpp -o $*.o
Expand All @@ -106,14 +107,11 @@ c_example_shlib.x: c_example.c libpcm.so
@rm -f $*.d.tmp

memoptest.x: memoptest.cpp
g++ -Wall -g -O0 -std=c++11 memoptest.cpp -o memoptest.x
$(CXX) -Wall -g -O0 -std=c++11 memoptest.cpp -o memoptest.x

dashboardtest.x: dashboardtest.cpp $(COMMON_OBJS)
$(CXX) -o $@ $^ $(LIB)

nice:
uncrustify --replace -c ~/uncrustify.cfg *.cpp *.h WinMSRDriver/Win7/*.h WinMSRDriver/Win7/*.c WinMSRDriver/WinXP/*.h WinMSRDriver/WinXP/*.c PCM_Win/*.h PCM_Win/*.cpp

prefix=/usr

ifneq ($(DESTDIR),)
Expand Down
35 changes: 27 additions & 8 deletions c_example.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
#include <stdio.h>
#include <dlfcn.h>
#include <stdint.h>
#include <stdlib.h>

int pcm_getcpu()
{
int id = -1;
asm volatile (
"rdtscp\n\t"
"mov %%ecx, %0\n\t":
"=r" (id) :: "%rax", "%rcx", "%rdx");
// processor ID is in ECX: https://www.felixcloutier.com/x86/rdtscp
return id;
int id = -1;
asm volatile (
"rdtscp\n\t"
"mov %%ecx, %0\n\t":
"=r" (id) :: "%rax", "%rcx", "%rdx");
// processor ID is in ECX: https://www.felixcloutier.com/x86/rdtscp
// Linux encodes the NUMA node starting at bit 12, so remove the NUMA
// bits when returning the CPU integer by masking with 0xFFF.
return id & 0xFFF;
}

struct {
Expand Down Expand Up @@ -38,8 +41,17 @@ uint64_t pcm_c_get_core_event(uint32_t, uint32_t);
int main(int argc, const char *argv[])
{
int i,a[100],b[100],c[100];
uint32_t total = 0;
int lcore_id;

/* Seed for predictable rand() results */
srand(0);
for (i=0; i < 100; ++i) {
a[i] = rand();
b[i] = rand();
c[i] = rand();
}

#ifdef PCM_DYNAMIC_LIB
void * handle = dlopen("libpcm.so", RTLD_LAZY);
if(!handle) {
Expand Down Expand Up @@ -85,12 +97,19 @@ int main(int argc, const char *argv[])
return -2;
}

printf("[c_example] Initializing PCM measurements:\n");
PCM.pcm_c_init();

printf("[c_example] Calling PCM start()\n");
PCM.pcm_c_start();
for(i=0;i<10000;i++)
c[i%100] = 4 * a[i%100] + b[i%100];
c[i%100] = 4 * a[i%100] + b[i%100];
for(i=0;i<100;i++)
total += c[i];
PCM.pcm_c_stop();

printf("[c_example] PCM measurment stopped, compute result %u\n", total);

lcore_id = pcm_getcpu();
printf("C:%lu I:%lu, IPC:%3.2f\n",
PCM.pcm_c_get_cycles(lcore_id),
Expand Down
11 changes: 11 additions & 0 deletions cppcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

cppcheck $1 --force --enable=warning --inline-suppr -iPCM-Service_Win -j $2 2> cppcheck.out

if [ -s cppcheck.out ]
then
cat cppcheck.out
exit 1
fi

echo No issues found

4 changes: 2 additions & 2 deletions cpuasynchcounter.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ class AsynchronCounterState {

friend void * UpdateCounters(void *);

// AsynchronCounterState(const& AsynchronCounterState); //unimplemeted
// const& AsynchronCounterState operator=(const& AsynchronCounterState); //unimplemented
AsynchronCounterState(const AsynchronCounterState &) = delete;
const AsynchronCounterState & operator = (const AsynchronCounterState &) = delete;

public:
AsynchronCounterState()
Expand Down
Loading