Skip to content

Commit

Permalink
Merge pull request #338 from opcm/push_2021_10_22
Browse files Browse the repository at this point in the history
Push 2021 10 22
  • Loading branch information
opcm authored Oct 25, 2021
2 parents 0212b38 + ec955f1 commit 93fc919
Show file tree
Hide file tree
Showing 41 changed files with 961 additions and 233 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/ci-clang-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: clang-scan

on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]

jobs:
build:

runs-on: ci-clang-scan
if: ${{ github.repository != 'opcm/pcm' }}

steps:
- uses: actions/checkout@v2
- name: scan-build
run: |
scan-build --exclude simdjson --status-bugs make -j
make clean
git clone https://github.com/simdjson/simdjson.git
scan-build --exclude simdjson --status-bugs make -j
21 changes: 21 additions & 0 deletions .github/workflows/ci-cppcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: cppcheck

on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]

jobs:
build:

runs-on: ci-cppcheck
if: ${{ github.repository != 'opcm/pcm' }}

steps:
- uses: actions/checkout@v2
- name: cppcheck_script
run: |
sh cppcheck.sh . `getconf _NPROCESSORS_ONLN`
git clone https://github.com/simdjson/simdjson.git
sh cppcheck.sh . `getconf _NPROCESSORS_ONLN`
23 changes: 23 additions & 0 deletions .github/workflows/ci-gcc10.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: g++ 10 build

on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]

jobs:
build:

runs-on: ci-gcc10
if: ${{ github.repository != 'opcm/pcm' }}

steps:
- uses: actions/checkout@v2
- name: make
run: |
g++ --version
make install prefix=. -j
make clean
git clone https://github.com/simdjson/simdjson.git
make install prefix=. -j
24 changes: 24 additions & 0 deletions .github/workflows/ci-gcc48.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: g++ 4.8 build

on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]

jobs:
build:

runs-on: ci-gcc48
if: ${{ github.repository != 'opcm/pcm' }}

steps:
- uses: actions/checkout@v2
- name: make
run: |
g++ --version
make install prefix=. -j
make clean
git clone https://github.com/simdjson/simdjson.git
make install prefix=. -j
23 changes: 23 additions & 0 deletions .github/workflows/ci-gcc5.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: g++ 5 build

on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]

jobs:
build:

runs-on: ci-gcc5
if: ${{ github.repository != 'opcm/pcm' }}

steps:
- uses: actions/checkout@v2
- name: make
run: |
g++ --version
make install prefix=. -j
make clean
git clone https://github.com/simdjson/simdjson.git
make install prefix=. -j
23 changes: 23 additions & 0 deletions .github/workflows/ci-gcc7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: g++ 7 build

on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]

jobs:
build:

runs-on: ci-gcc7
if: ${{ github.repository != 'opcm/pcm' }}

steps:
- uses: actions/checkout@v2
- name: make
run: |
g++ --version
make install prefix=. -j
make clean
git clone https://github.com/simdjson/simdjson.git
make install prefix=. -j
23 changes: 23 additions & 0 deletions .github/workflows/ci-gcc9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: g++ 9 build

on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]

jobs:
build:

runs-on: ci-gcc9
if: ${{ github.repository != 'opcm/pcm' }}

steps:
- uses: actions/checkout@v2
- name: make
run: |
g++ --version
make install prefix=. -j
make clean
git clone https://github.com/simdjson/simdjson.git
make install prefix=. -j
26 changes: 26 additions & 0 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: MSVC Windows build

on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]

jobs:
build:

runs-on: ci-windows
if: ${{ github.repository != 'opcm/pcm' }}

steps:
- uses: actions/checkout@v2

- name: Add MSBuild to PATH
uses: microsoft/[email protected]

- name: msbuild
run: |
msbuild pcm-all.sln /p:Configuration=Release,Platform=x64 /t:Clean,Build /m
git clone https://github.com/simdjson/simdjson.git
msbuild pcm-all.sln /p:Configuration=Release,Platform=x64 /t:Clean,Build /m
2 changes: 2 additions & 0 deletions ENVVAR_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
`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

`PCM_PRINT_TOPOLOGY=1` : print detailed CPU topology
6 changes: 6 additions & 0 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,9 @@ How to fix it?
export PCM_NO_PERF=1
pcm.x -r
```

## Q10

If you are getting the error `Starting MSR service failed with error 3 The system cannot find the path specified.` try to uninstall the driver by running `pcm --uninstallDriver` and optionally reboot the system.


12 changes: 6 additions & 6 deletions PCM-Raw_Win/pcm-raw-win.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,29 @@
<ProjectGuid>{5FF04B76-D9BC-409C-A571-D760529F8AC4}</ProjectGuid>
<RootNamespace>pcm-raw-win</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
Expand Down Expand Up @@ -193,4 +193,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
6 changes: 0 additions & 6 deletions PCM_RAW_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,4 @@ The unit can be logical core, memory channel, CHA, etc, depending on the event t

Limitations:

Offcore response event are not supported and need to be specified using the raw encoding format. For example:

```
pcm-raw.x -e core/config=0x301b7,config1=0x4003C0001,config2=0x10003C0001,name=OCR.DEMAND_DATA_RD.L3_HIT.SNOOP_HIT_NO_FWD/ -e core/config=0x301bb,name=OCR.DEMAND_DATA_RD.L3_HIT.SNOOP_HITM
```

Event-to-counter scheduling restrictions are not validated. The events are scheduled in order. The user need to make sure events are ordered correctly using emon or manually inspecting counter event restrictions specified in json files (https://download.01.org/perfmon/).
8 changes: 7 additions & 1 deletion PMURegisterDeclarations/GenuineIntel-6-55-4.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
"Invert": {"Config": 0, "Position": 23, "Width": 1},
"CounterMask": {"Config": 0, "Position": 24, "Width": 8},
"InTX": {"Config": 0, "Position": 32, "Width": 1, "DefaultValue": 0},
"InTXCheckpointed": {"Config": 0, "Position": 33, "Width": 1, "DefaultValue": 0}
"InTXCheckpointed": {"Config": 0, "Position": 33, "Width": 1, "DefaultValue": 0},
"MSRIndex": {
"0x1a6" : {"Config": 1, "Position": 0, "Width": 64},
"0x1a7" : {"Config": 2, "Position": 0, "Width": 64},
"0x3f6" : {"Config": 3, "Position": 0, "Width": 64},
"0x3f7" : {"Config": 4, "Position": 0, "Width": 64}
}
},
"fixed0" : {
"OS": {"Config": 0, "Position": 0, "Width": 1, "DefaultValue": 1},
Expand Down
8 changes: 7 additions & 1 deletion PMURegisterDeclarations/GenuineIntel-6-55-7.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
"Invert": {"Config": 0, "Position": 23, "Width": 1},
"CounterMask": {"Config": 0, "Position": 24, "Width": 8},
"InTX": {"Config": 0, "Position": 32, "Width": 1, "DefaultValue": 0},
"InTXCheckpointed": {"Config": 0, "Position": 33, "Width": 1, "DefaultValue": 0}
"InTXCheckpointed": {"Config": 0, "Position": 33, "Width": 1, "DefaultValue": 0},
"MSRIndex": {
"0x1a6" : {"Config": 1, "Position": 0, "Width": 64},
"0x1a7" : {"Config": 2, "Position": 0, "Width": 64},
"0x3f6" : {"Config": 3, "Position": 0, "Width": 64},
"0x3f7" : {"Config": 4, "Position": 0, "Width": 64}
}
},
"fixed0" : {
"OS": {"Config": 0, "Position": 0, "Width": 1, "DefaultValue": 1},
Expand Down
8 changes: 7 additions & 1 deletion PMURegisterDeclarations/GenuineIntel-6-6A-6.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
"Invert": {"Config": 0, "Position": 23, "Width": 1},
"CounterMask": {"Config": 0, "Position": 24, "Width": 8},
"InTX": {"Config": 0, "Position": 32, "Width": 1, "DefaultValue": 0},
"InTXCheckpointed": {"Config": 0, "Position": 33, "Width": 1, "DefaultValue": 0}
"InTXCheckpointed": {"Config": 0, "Position": 33, "Width": 1, "DefaultValue": 0},
"MSRIndex": {
"0x1a6" : {"Config": 1, "Position": 0, "Width": 64},
"0x1a7" : {"Config": 2, "Position": 0, "Width": 64},
"0x3f6" : {"Config": 3, "Position": 0, "Width": 64},
"0x3f7" : {"Config": 4, "Position": 0, "Width": 64}
}
},
"fixed0" : {
"OS": {"Config": 0, "Position": 0, "Width": 1, "DefaultValue": 1},
Expand Down
7 changes: 6 additions & 1 deletion PMURegisterDeclarations/GenuineIntel-6-8E-C.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
"Invert": {"Config": 0, "Position": 23, "Width": 1},
"CounterMask": {"Config": 0, "Position": 24, "Width": 8},
"InTX": {"Config": 0, "Position": 32, "Width": 1, "DefaultValue": 0},
"InTXCheckpointed": {"Config": 0, "Position": 33, "Width": 1, "DefaultValue": 0}
"MSRIndex": {
"0x1a6" : {"Config": 1, "Position": 0, "Width": 64},
"0x1a7" : {"Config": 2, "Position": 0, "Width": 64},
"0x3f6" : {"Config": 3, "Position": 0, "Width": 64},
"0x3f7" : {"Config": 4, "Position": 0, "Width": 64}
}
},
"fixed0" : {
"OS": {"Config": 0, "Position": 0, "Width": 1, "DefaultValue": 1},
Expand Down
2 changes: 2 additions & 0 deletions WINDOWS_HOWTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Alternatively you can achieve the same using the “Properties” Windows menu o

![Screenshot](run-as-administrator.png)

If you are getting the error `Starting MSR service failed with error 3 The system cannot find the path specified.` try to uninstall the driver by running `pcm --uninstallDriver` and optionally reboot the system.

Graphical Perfmon front end:

1.Compile the windows MSR driver (msr.sys) with Windows DDK Kit (see the sources in the WinMSRDriver directory). For Windows 7 and later versions you have to sign the msr.sys driver additionally ([http://msdn.microsoft.com/en-us/library/ms537361(VS.85).aspx](http://msdn.microsoft.com/en-us/library/ms537361(VS.85).aspx)).
Expand Down
26 changes: 26 additions & 0 deletions WinMSRDriver/msrmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
struct DeviceExtension
{
HANDLE devMemHandle;
HANDLE counterSetHandle;
};

DRIVER_INITIALIZE DriverEntry;
Expand Down Expand Up @@ -97,6 +98,7 @@ DriverEntry(
DbgPrint("Error: failed ZwOpenSection(devMemHandle) => %08X\n", status);
return status;
}
pExt->counterSetHandle = NULL;

IoCreateSymbolicLink(&dosDeviceName, &UnicodeString);

Expand Down Expand Up @@ -231,6 +233,30 @@ NTSTATUS deviceControl(PDEVICE_OBJECT DeviceObject, PIRP Irp)
case IO_CTL_MUNMAP:
status = ZwUnmapViewOfSection(ZwCurrentProcess(), (PVOID) input_mmap_req->address.QuadPart);
break;
case IO_CTL_PMU_ALLOC_SUPPORT:
*output = 1;
Irp->IoStatus.Information = sizeof(ULONG64); // result size
break;
case IO_CTL_PMU_ALLOC:
if (pExt->counterSetHandle == NULL)
{
status = HalAllocateHardwareCounters(NULL, 0, NULL, &(pExt->counterSetHandle));
}
*output = status;
Irp->IoStatus.Information = sizeof(ULONG64); // result size
break;
case IO_CTL_PMU_FREE:
if (pExt->counterSetHandle != NULL)
{
status = HalFreeHardwareCounters(pExt->counterSetHandle);
if (status == STATUS_SUCCESS)
{
pExt->counterSetHandle = NULL;
}
}
*output = status;
Irp->IoStatus.Information = sizeof(ULONG64); // result size
break;
case IO_CTL_PCICFG_WRITE:
if (inputSize < sizeof(struct PCICFG_Request) || (input_pcicfg_req->bytes != 4 && input_pcicfg_req->bytes != 8))
{
Expand Down
3 changes: 3 additions & 0 deletions WinMSRDriver/msrstruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
#define IO_CTL_MMAP_SUPPORT CTL_CODE(MSR_DEV_TYPE, 0x804, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IO_CTL_MMAP CTL_CODE(MSR_DEV_TYPE, 0x805, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IO_CTL_MUNMAP CTL_CODE(MSR_DEV_TYPE, 0x806, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IO_CTL_PMU_ALLOC_SUPPORT CTL_CODE(MSR_DEV_TYPE, 0x807, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IO_CTL_PMU_ALLOC CTL_CODE(MSR_DEV_TYPE, 0x808, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IO_CTL_PMU_FREE CTL_CODE(MSR_DEV_TYPE, 0x809, METHOD_BUFFERED, FILE_ANY_ACCESS)

struct MSR_Request
{
Expand Down
2 changes: 1 addition & 1 deletion c_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct {
uint64_t (*pcm_c_get_cycles)(uint32_t core_id);
uint64_t (*pcm_c_get_instr)(uint32_t core_id);
uint64_t (*pcm_c_get_core_event)(uint32_t core_id, uint32_t event_id);
} PCM;
} PCM; // lgtm [cpp/short-global-name]

#ifndef PCM_DYNAMIC_LIB
/* Library functions declaration (instead of .h file) */
Expand Down
Loading

0 comments on commit 93fc919

Please sign in to comment.