└── src
├── .gitignore
├── .gitattributes
├── FREEBSD_HOWTO.txt
├── WinMSRDriver
├── Win7
│ ├── makefile
│ ├── mymake.bat
│ ├── sources
│ ├── msr.h
│ └── msrstruct.h
└── WinXP
│ ├── makefile
│ ├── mymake.bat
│ ├── sources
│ ├── msr.h
│ └── msrstruct.h
├── check_win_build.sh
├── KSysGuard HOWTO.docx
├── KSysGuard HOWTO.pdf
├── MacMSRDriver
├── PcmMsr
│ ├── en.lproj
│ │ └── InfoPlist.strings
│ ├── PcmMsr-Prefix.pch
│ ├── PcmMsr-Info.plist
│ ├── UserKernelShared.h
│ ├── PcmMsr.h
│ └── PcmMsrClient.h
├── kextunload.sh
├── PcmMsr.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── aiott.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── aiott.xcuserdatad
│ │ ├── xcschemes
│ │ ├── xcschememanagement.plist
│ │ ├── PcmMsr.xcscheme
│ │ └── PcmMsrLibrary.xcscheme
│ │ └── xcdebugger
│ │ └── Breakpoints.xcbkptlist
├── kextload.sh
├── Makefile
├── MSRAccessorPublic.h
├── MSRAccessor.h
├── DriverInterface.h
├── MSRKernel.h
├── PCIDriverInterface.h
├── MSRAccessor.cpp
└── DriverInterface.c
├── PCM-Service_Win
├── app.ico
├── resource.h
├── PCM-Service.exe.config
├── ReadMe.txt
├── app.rc
├── PCMInstaller.cpp
├── AssemblyInfo.cpp
├── PCMService.cpp
├── PCMInstaller.h
└── PCMService.resX
├── pcm3d
├── demo.sh
├── run_mem_op_test_aff.sh
├── pcm3d.pro
├── widget.ui
├── demo_mem.sh
├── demo_qpi.sh
├── widget.h
└── main.cpp
├── PCM-MSR_Win
├── pcm-msr-win.cpp
├── stdafx.cpp
├── stdafx.h
└── pcm-msr-win.vcproj
├── PCM-TSX_Win
├── pcm-tsx-win.cpp
├── stdafx.cpp
├── stdafx.h
└── pcm-tsx-win.vcproj
├── PCM-NUMA_Win
├── pcm-numa-win.cpp
├── stdafx.cpp
├── stdafx.h
└── pcm-numa-win.vcproj
├── PCM-PCIE_Win
├── pcm-pcie-win.cpp
├── stdafx.cpp
├── stdafx.h
└── pcm-pcie-win.vcproj
├── PCM-Power_Win
├── pcm-power-win.cpp
├── stdafx.cpp
├── stdafx.h
└── ReadMe.txt
├── PCM-Memory_Win
├── pcm-memory-win.cpp
├── stdafx.cpp
└── stdafx.h
├── TODO
├── gen_new_win_project.sh
├── readmem.sh
├── LINUX_HOWTO.txt
├── build_all.bat
├── freegetopt
├── ChangeLog
├── LICENSE
├── README
└── getopt.h
├── winring0
├── COPYRIGHT.txt
├── OlsDef.h
├── OlsApiInitExt.h
└── OlsApiInitDef.h
├── PCM_Win
├── ReadMe.txt
├── pcm.cpp
├── stdafx.cpp
└── stdafx.h
├── Intelpcm.dll
├── ReadMe.txt
├── Intelpcm.cpp
├── dllmain.cpp
├── Intelpcm.h
└── targetver.h
├── license.txt
├── MAC_HOWTO.txt
├── Makefile
├── client_bw.h
├── readmem.cpp
├── msrtest.cpp
├── msr.h
├── utils.h
├── memoptest.cpp
├── pcm-msr.cpp
├── pci.h
├── client_bw.cpp
└── width_extender.h
/src/.gitignore:
--------------------------------------------------------------------------------
1 | *.o
2 | *.x
3 |
--------------------------------------------------------------------------------
/src/.gitattributes:
--------------------------------------------------------------------------------
1 | cpucounters.h export-subst
2 |
--------------------------------------------------------------------------------
/src/FREEBSD_HOWTO.txt:
--------------------------------------------------------------------------------
1 | see LINUX_HOWTO.txt
2 |
3 |
--------------------------------------------------------------------------------
/src/WinMSRDriver/Win7/makefile:
--------------------------------------------------------------------------------
1 | !INCLUDE $(NTMAKEENV)\makefile.def
--------------------------------------------------------------------------------
/src/WinMSRDriver/WinXP/makefile:
--------------------------------------------------------------------------------
1 | !INCLUDE $(NTMAKEENV)\makefile.def
--------------------------------------------------------------------------------
/src/check_win_build.sh:
--------------------------------------------------------------------------------
1 |
2 | cmd /c build_all.bat | egrep 'Error'
3 |
4 |
--------------------------------------------------------------------------------
/src/WinMSRDriver/WinXP/mymake.bat:
--------------------------------------------------------------------------------
1 | set BUILD_PATH=
2 |
3 | nmake
4 |
5 |
--------------------------------------------------------------------------------
/src/KSysGuard HOWTO.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/erikarn/intel-pcm/HEAD/src/KSysGuard HOWTO.docx
--------------------------------------------------------------------------------
/src/KSysGuard HOWTO.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/erikarn/intel-pcm/HEAD/src/KSysGuard HOWTO.pdf
--------------------------------------------------------------------------------
/src/MacMSRDriver/PcmMsr/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/src/PCM-Service_Win/app.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/erikarn/intel-pcm/HEAD/src/PCM-Service_Win/app.ico
--------------------------------------------------------------------------------
/src/PCM-Service_Win/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by app.rc
4 |
--------------------------------------------------------------------------------
/src/pcm3d/demo.sh:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | for i in {0..31}; do sh run_mem_op_test_aff.sh $i;sleep 2; killall memoptest ; done;
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/PcmMsr/PcmMsr-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'PcmMsr' target in the 'PcmMsr' project
3 | //
4 |
5 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/kextunload.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | kextunload /System/Library/Extensions/PcmMsrDriver.kext
4 | rm -rf /System/Library/Extensions/PcmMsrDriver.kext
5 |
--------------------------------------------------------------------------------
/src/PCM-MSR_Win/pcm-msr-win.cpp:
--------------------------------------------------------------------------------
1 | // pcm-msr-win.cpp : Defines the entry point for the console application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 | #include "../pcm-msr.cpp"
7 |
--------------------------------------------------------------------------------
/src/PCM-Service_Win/PCM-Service.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/PCM-TSX_Win/pcm-tsx-win.cpp:
--------------------------------------------------------------------------------
1 | // pcm-tsx-win.cpp : Defines the entry point for the console application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 | #include "../pcm-tsx.cpp"
7 |
--------------------------------------------------------------------------------
/src/PCM-NUMA_Win/pcm-numa-win.cpp:
--------------------------------------------------------------------------------
1 | // pcm-numa-win.cpp : Defines the entry point for the console application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 | #include "../pcm-numa.cpp"
7 |
--------------------------------------------------------------------------------
/src/PCM-PCIE_Win/pcm-pcie-win.cpp:
--------------------------------------------------------------------------------
1 | // pcm-pcie-win.cpp : Defines the entry point for the console application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 | #include "../pcm-pcie.cpp"
7 |
--------------------------------------------------------------------------------
/src/PCM-Power_Win/pcm-power-win.cpp:
--------------------------------------------------------------------------------
1 | // pcm-power-win.cpp : Defines the entry point for the console application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 | #include "../pcm-power.cpp"
7 |
--------------------------------------------------------------------------------
/src/PCM-Memory_Win/pcm-memory-win.cpp:
--------------------------------------------------------------------------------
1 | // pcm-memory-win.cpp : Defines the entry point for the console application.
2 | //
3 |
4 | #include "stdafx.h"
5 |
6 | #include "../pcm-memory.cpp"
7 |
--------------------------------------------------------------------------------
/src/TODO:
--------------------------------------------------------------------------------
1 |
2 | TODO
3 |
4 | * Support non-zero invert and cmask fields for custom events
5 | * Remember and handle properly the PMU program mode globally on the box/system
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/WinMSRDriver/Win7/mymake.bat:
--------------------------------------------------------------------------------
1 | set BUILD_PATH=
2 |
3 | rmdir /S /Q objfre_win7_amd64
4 | nmake
5 |
6 | rem chdir objfre_win7_amd64\amd64
7 | rem copy msr.sys c:\
8 | rem chdir ..
9 | rem chdir ..
--------------------------------------------------------------------------------
/src/WinMSRDriver/WinXP/sources:
--------------------------------------------------------------------------------
1 | TARGETNAME=msr
2 | TARGETTYPE=DRIVER
3 |
4 | MSC_WARNING_LEVEL=/W3 /WX
5 |
6 |
7 | SOURCES=msrmain.c
8 |
9 | PRECOMPILED_INCLUDE=msr.h
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/PcmMsr.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/PcmMsr.xcodeproj/project.xcworkspace/xcuserdata/aiott.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/erikarn/intel-pcm/HEAD/src/MacMSRDriver/PcmMsr.xcodeproj/project.xcworkspace/xcuserdata/aiott.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/src/pcm3d/run_mem_op_test_aff.sh:
--------------------------------------------------------------------------------
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 | taskset -c $1 ../memoptest 0 >> /dev/null &
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/kextload.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | cp -R build/Release/PcmMsrDriver.kext /tmp/.
4 | mv /tmp/PcmMsrDriver.kext /System/Library/Extensions
5 | chown -R root:wheel /System/Library/Extensions/PcmMsrDriver.kext
6 | kextload /System/Library/Extensions/PcmMsrDriver.kext
7 |
--------------------------------------------------------------------------------
/src/PCM-MSR_Win/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // pcm.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/src/PCM-Memory_Win/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // pcm.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/src/PCM-NUMA_Win/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // pcm.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/src/PCM-PCIE_Win/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // pcm.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/src/PCM-Power_Win/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // pcm.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/src/PCM-TSX_Win/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // pcm.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/src/WinMSRDriver/Win7/sources:
--------------------------------------------------------------------------------
1 | TARGETNAME=msr
2 | TARGETTYPE=DRIVER
3 | NTDDI_VERSION=NTDDI_WIN7
4 |
5 | MSC_WARNING_LEVEL=/W3 /WX
6 |
7 |
8 | INCLUDES=\
9 | $(DDK_INC_PATH);
10 |
11 | TARGETLIBS=\
12 | $(DDK_LIB_PATH)\ntoskrnl.lib
13 |
14 |
15 | SOURCES=msrmain.c
16 |
17 | PRECOMPILED_INCLUDE=msr.h
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/src/gen_new_win_project.sh:
--------------------------------------------------------------------------------
1 |
2 | DIRNAME=PCM-NUMA_Win
3 | UTILNAME=pcm-numa
4 |
5 | rm -rf $DIRNAME
6 |
7 | mkdir $DIRNAME
8 | cp PCM-Power_Win/stdafx.h $DIRNAME/stdafx.h
9 | cp PCM-Power_Win/stdafx.cpp $DIRNAME/stdafx.cpp
10 |
11 | sed 's/pcm-power/'$UTILNAME'/g' PCM-Power_Win/pcm-power-win.cpp > $DIRNAME/$UTILNAME-win.cpp
12 |
13 | sed 's/pcm-power/'$UTILNAME'/g' PCM-Power_Win/pcm-power-win.vcproj > $DIRNAME/$UTILNAME-win.vcproj
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/pcm3d/pcm3d.pro:
--------------------------------------------------------------------------------
1 | #-------------------------------------------------
2 | #
3 | # Project created by QtCreator 2011-08-12T15:31:25
4 | #
5 | #-------------------------------------------------
6 |
7 | QT += core gui opengl
8 |
9 | TARGET = pcm3d
10 | TEMPLATE = app
11 |
12 |
13 | SOURCES += main.cpp\
14 | widget.cpp\
15 | ../msr.cpp\
16 | ../pci.cpp\
17 | ../cpucounters.cpp
18 |
19 | HEADERS += widget.h
20 |
21 | FORMS += widget.ui
22 |
--------------------------------------------------------------------------------
/src/pcm3d/widget.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Widget
4 |
5 |
6 |
7 | 0
8 | 0
9 | 400
10 | 300
11 |
12 |
13 |
14 | Intel(r) Performance Counter Monitor - 3D view
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/PCM-MSR_Win/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
9 | #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
10 | #endif
11 |
12 | #include
13 | #include
14 |
15 |
16 | // TODO: reference additional headers your program requires here
17 |
--------------------------------------------------------------------------------
/src/PCM-NUMA_Win/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
9 | #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
10 | #endif
11 |
12 | #include
13 | #include
14 |
15 |
16 | // TODO: reference additional headers your program requires here
17 |
--------------------------------------------------------------------------------
/src/PCM-PCIE_Win/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
9 | #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
10 | #endif
11 |
12 | #include
13 | #include
14 |
15 |
16 | // TODO: reference additional headers your program requires here
17 |
--------------------------------------------------------------------------------
/src/PCM-TSX_Win/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
9 | #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
10 | #endif
11 |
12 | #include
13 | #include
14 |
15 |
16 | // TODO: reference additional headers your program requires here
17 |
--------------------------------------------------------------------------------
/src/PCM-Memory_Win/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
9 | #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
10 | #endif
11 |
12 | #include
13 | #include
14 |
15 |
16 | // TODO: reference additional headers your program requires here
17 |
--------------------------------------------------------------------------------
/src/PCM-Power_Win/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
9 | #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
10 | #endif
11 |
12 | #include
13 | #include
14 |
15 |
16 | // TODO: reference additional headers your program requires here
17 |
--------------------------------------------------------------------------------
/src/readmem.sh:
--------------------------------------------------------------------------------
1 |
2 |
3 | numactl --cpunodebind=0 --membind=0 ./readmem 10 &
4 | numactl --cpunodebind=1 --membind=1 ./readmem 10 &
5 | numactl --cpunodebind=0 --membind=0 ./readmem 10 &
6 | numactl --cpunodebind=1 --membind=1 ./readmem 10 &
7 | numactl --cpunodebind=0 --membind=0 ./readmem 10 &
8 | numactl --cpunodebind=1 --membind=1 ./readmem 10 &
9 | numactl --cpunodebind=0 --membind=0 ./readmem 10 &
10 | numactl --cpunodebind=1 --membind=1 ./readmem 10 &
11 | numactl --cpunodebind=0 --membind=0 ./readmem 10 &
12 | numactl --cpunodebind=1 --membind=1 ./readmem 10 &
13 | numactl --cpunodebind=0 --membind=0 ./readmem 10 &
14 | numactl --cpunodebind=1 --membind=1 ./readmem 10 &
15 |
16 |
--------------------------------------------------------------------------------
/src/pcm3d/demo_mem.sh:
--------------------------------------------------------------------------------
1 |
2 | for i in 1 2 3 4; do
3 |
4 | sh run_mem_op_test_aff.sh 0 &
5 | sh run_mem_op_test_aff.sh 1 &
6 | sh run_mem_op_test_aff.sh 2 &
7 | sh run_mem_op_test_aff.sh 3 &
8 | sh run_mem_op_test_aff.sh 4 &
9 | sh run_mem_op_test_aff.sh 5 &
10 | sh run_mem_op_test_aff.sh 6 &
11 | sh run_mem_op_test_aff.sh 7 &
12 |
13 | sleep 5
14 | killall memoptest
15 |
16 |
17 | sh run_mem_op_test_aff.sh 8 &
18 | sh run_mem_op_test_aff.sh 9 &
19 | sh run_mem_op_test_aff.sh 10 &
20 | sh run_mem_op_test_aff.sh 11 &
21 | sh run_mem_op_test_aff.sh 12 &
22 | sh run_mem_op_test_aff.sh 13 &
23 | sh run_mem_op_test_aff.sh 14 &
24 | sh run_mem_op_test_aff.sh 15 &
25 |
26 | sleep 5
27 | killall memoptest
28 |
29 | done
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/LINUX_HOWTO.txt:
--------------------------------------------------------------------------------
1 | Please just type make in the main PCM directory and see what binaries have been build: ls *.x
2 |
3 | pcm.x - command line PCM utility
4 | pcm-sensor.x - PCM plugin for use with KSysGuard
5 | pcm-power.x - command line utility for reading energy and power related metrics on Intel(r) microarchitecture codename Sandy/Ivy-Bridge EP/EN/E/EX
6 | pcm-memory.x - command line utility for reading memory channel related metrics on Intel(r) microarchitecture codename Sandy/Ivy-Bridge EP/EN/E/EX
7 | pcm-msr.x - utility to read-write model specific registers
8 |
9 | if compiled with Linux perf (-DPCM_USE_PERF option in Makefile) then additionally CAP_SYS_ADMIN privileges needed for users executing the utilities
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/Makefile:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (c) 2012 Intel Corporation
3 | # written by Austen Ott
4 | #
5 | # Build and install the PcmMsr kext and dynamically linked library.
6 |
7 | kext:
8 | xcodebuild -configuration Release -target PcmMsrDriver clean build
9 |
10 | library:
11 | xcodebuild -configuration Release -target PcmMsrLibrary clean build
12 |
13 | install: kext library
14 | sudo sh ./kextload.sh
15 | sudo cp build/Release/libPcmMsr.dylib /usr/lib/
16 | sudo cp MSRAccessorPublic.h /usr/include/MSRAccessor.h
17 | sudo cp MSRKernel.h /usr/include/MSRKernel.h
18 | sudo cp PCIDriverInterface.h /usr/include/PCIDriverInterface.h
19 |
20 | uninstall:
21 | sudo sh ./kextunload.sh
22 | sudo rm /usr/include/MSRKernel.h
23 | sudo rm /usr/include/MSRAccessor.h
24 | sudo rm /usr/lib/libPcmMsr.dylib
25 | sudo rm /usr/include/PCIDriverInterface.h
26 |
--------------------------------------------------------------------------------
/src/build_all.bat:
--------------------------------------------------------------------------------
1 |
2 | REM change path to your VCVARS.BAT
3 | CALL "c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\vcvars32.bat"
4 |
5 | for %%p in (PCM) do (
6 | @echo Building %%p
7 | chdir %%p_Win
8 | vcupgrade -overwrite %%p.vcproj
9 | msbuild %%p.vcxproj
10 | chdir ..
11 | )
12 |
13 | @echo Building Intelpcm.dll
14 | chdir Intelpcm.dll
15 | vcupgrade -overwrite Intelpcm.dll.vcproj
16 | msbuild Intelpcm.dll.vcxproj
17 | chdir ..
18 |
19 | @echo Building PCM-Service
20 | chdir PCM-Service_Win
21 | vcupgrade -overwrite PCMService.vcproj
22 | msbuild PCMService.vcxproj
23 | chdir ..
24 |
25 |
26 | for %%p in (PCM-MSR PCM-TSX PCM-Memory PCM-NUMA PCM-PCIE PCM-Power) do (
27 | @echo Building %%p
28 | chdir %%p_Win
29 | vcupgrade -overwrite %%p-win.vcproj
30 | msbuild %%p-win.vcxproj
31 | chdir ..
32 | )
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/PcmMsr.xcodeproj/xcuserdata/aiott.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PcmMsr.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 | PcmMsrLibrary.xcscheme
13 |
14 | orderHint
15 | 1
16 |
17 |
18 | SuppressBuildableAutocreation
19 |
20 | 81ADBF11156EEB93006D9B47
21 |
22 | primary
23 |
24 |
25 | 81DEAF55157008B7005E8EC6
26 |
27 | primary
28 |
29 |
30 | 81F91BBB156D9BF8007DD788
31 |
32 | primary
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/src/freegetopt/ChangeLog:
--------------------------------------------------------------------------------
1 | 2003-10-25 Mark K. Kim {getopt*cbreak.org}
2 |
3 | * *: freegetopt 0.11 released.
4 |
5 | 2003-10-25 Mark K. Kim {getopt*cbreak.org}
6 |
7 | * ChangeLog: ChangeLog file added.
8 |
9 | * LICENSE: License file added. License is now officially BSD.
10 |
11 | * README: Updated to reflect the new license. CVS tracking data
12 | added.
13 |
14 | * getopt.h, getopt.c: License text added to the beginning of
15 | each file. CVS tracking data added.
16 |
17 | * test.c: License text added to the beginning of the file.
18 | CVS tracking data added.
19 |
20 | 2003-10-20 Mark K. Kim {getopt*cbreak.org}
21 |
22 | * *: Sourceforge project approval. Name changed to freegetopt.
23 | License is now officially BSD.
24 |
25 | 2003-09-29 Jon Higdon {jhigdon*nni.com}
26 |
27 | * test.c: GCC 3.x gives compound statement warning. Fixed.
28 |
29 | 2003.01.12 Mark K. Kim {getopt*cbreak.org}
30 |
31 | * *: Getopt 1.0 released! Supports only short options, but
32 | I think it's fully compatible with GNU getopt except for the
33 | value of optind while getopt is still running. The value
34 | of optind is same after getopt finishes running, however.
35 |
36 |
--------------------------------------------------------------------------------
/src/winring0/COPYRIGHT.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2007-2009 OpenLibSys.org. All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions
5 | are met:
6 | 1. Redistributions of source code must retain the above copyright
7 | notice, this list of conditions and the following disclaimer.
8 | 2. Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 |
12 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
13 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
19 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 |
--------------------------------------------------------------------------------
/src/PCM-Service_Win/ReadMe.txt:
--------------------------------------------------------------------------------
1 | ========================================================================
2 | APPLICATION : PMU Service Project Overview
3 | ========================================================================
4 |
5 | Windows Service Wizard has created this PMU Service Application for you.
6 |
7 | This file contains a summary of what you will find in each of the files that
8 | make up your PMU Service application.
9 |
10 | PMU Service.vcproj
11 | This is the main project file for VC++ projects generated using a Windows Service Wizard.
12 | It contains information about the version of Visual C++ that generated the file, and
13 | information about the platforms, configurations.
14 |
15 | PMU ServiceWinService.cpp
16 | This is the main application source file.
17 |
18 | AssemblyInfo.cpp
19 | Contains custom attributes for modifying assembly metadata.
20 |
21 |
22 | /////////////////////////////////////////////////////////////////////////////
23 | Other notes:
24 |
25 | Windows Service Wizard uses "TODO:" to indicate parts of the source code you
26 | should add to or customize.
27 |
28 | /////////////////////////////////////////////////////////////////////////////
29 |
30 | To run your service:
31 | 1. Build the project
32 | 2. From the command line, run:
33 | PMU Service.exe -Install
34 |
--------------------------------------------------------------------------------
/src/PCM_Win/ReadMe.txt:
--------------------------------------------------------------------------------
1 | ========================================================================
2 | CONSOLE APPLICATION : pcm Project Overview
3 | ========================================================================
4 |
5 | AppWizard has created this pcm application for you.
6 |
7 | This file contains a summary of what you will find in each of the files that
8 | make up your pcm application.
9 |
10 |
11 | pcm.vcproj
12 | This is the main project file for VC++ projects generated using an Application Wizard.
13 | It contains information about the version of Visual C++ that generated the file, and
14 | information about the platforms, configurations, and project features selected with the
15 | Application Wizard.
16 |
17 | pcm.cpp
18 | This is the main application source file.
19 |
20 | /////////////////////////////////////////////////////////////////////////////
21 | Other standard files:
22 |
23 | StdAfx.h, StdAfx.cpp
24 | These files are used to build a precompiled header (PCH) file
25 | named pcm.pch and a precompiled types file named StdAfx.obj.
26 |
27 | /////////////////////////////////////////////////////////////////////////////
28 | Other notes:
29 |
30 | AppWizard uses "TODO:" comments to indicate parts of the source code you
31 | should add to or customize.
32 |
33 | /////////////////////////////////////////////////////////////////////////////
34 |
--------------------------------------------------------------------------------
/src/PCM-Power_Win/ReadMe.txt:
--------------------------------------------------------------------------------
1 | ========================================================================
2 | CONSOLE APPLICATION : pcm Project Overview
3 | ========================================================================
4 |
5 | AppWizard has created this pcm application for you.
6 |
7 | This file contains a summary of what you will find in each of the files that
8 | make up your pcm application.
9 |
10 |
11 | pcm.vcproj
12 | This is the main project file for VC++ projects generated using an Application Wizard.
13 | It contains information about the version of Visual C++ that generated the file, and
14 | information about the platforms, configurations, and project features selected with the
15 | Application Wizard.
16 |
17 | pcm.cpp
18 | This is the main application source file.
19 |
20 | /////////////////////////////////////////////////////////////////////////////
21 | Other standard files:
22 |
23 | StdAfx.h, StdAfx.cpp
24 | These files are used to build a precompiled header (PCH) file
25 | named pcm.pch and a precompiled types file named StdAfx.obj.
26 |
27 | /////////////////////////////////////////////////////////////////////////////
28 | Other notes:
29 |
30 | AppWizard uses "TODO:" comments to indicate parts of the source code you
31 | should add to or customize.
32 |
33 | /////////////////////////////////////////////////////////////////////////////
34 |
--------------------------------------------------------------------------------
/src/Intelpcm.dll/ReadMe.txt:
--------------------------------------------------------------------------------
1 | ========================================================================
2 | DYNAMIC LINK LIBRARY : PMU Library Project Overview
3 | ========================================================================
4 |
5 | AppWizard has created this PMU Library DLL for you.
6 |
7 | This file contains a summary of what you will find in each of the files that
8 | make up your PMU Library application.
9 |
10 |
11 | PMU Library.vcproj
12 | This is the main project file for VC++ projects generated using an Application Wizard.
13 | It contains information about the version of Visual C++ that generated the file, and
14 | information about the platforms, configurations, and project features selected with the
15 | Application Wizard.
16 |
17 | PMU Library.cpp
18 | This is the main DLL source file.
19 |
20 | /////////////////////////////////////////////////////////////////////////////
21 | Other standard files:
22 |
23 | StdAfx.h, StdAfx.cpp
24 | These files are used to build a precompiled header (PCH) file
25 | named PMU Library.pch and a precompiled types file named StdAfx.obj.
26 |
27 | /////////////////////////////////////////////////////////////////////////////
28 | Other notes:
29 |
30 | AppWizard uses "TODO:" comments to indicate parts of the source code you
31 | should add to or customize.
32 |
33 | /////////////////////////////////////////////////////////////////////////////
34 |
--------------------------------------------------------------------------------
/src/license.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2009-2013, Intel Corporation
2 | All rights reserved.
3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
5 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
6 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
7 |
8 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9 |
--------------------------------------------------------------------------------
/src/pcm3d/demo_qpi.sh:
--------------------------------------------------------------------------------
1 |
2 | echo "press any key to start"
3 |
4 | read a
5 |
6 | numactl --cpunodebind=0 --membind=1 ../memoptest 0 >> /dev/null &
7 | sleep 1
8 | numactl --cpunodebind=0 --membind=1 ../memoptest 0 >> /dev/null &
9 | sleep 1
10 | numactl --cpunodebind=0 --membind=1 ../memoptest 0 >> /dev/null &
11 | sleep 1
12 | numactl --cpunodebind=0 --membind=1 ../memoptest 0 >> /dev/null &
13 | sleep 1
14 | numactl --cpunodebind=0 --membind=1 ../memoptest 0 >> /dev/null &
15 | sleep 1
16 | numactl --cpunodebind=0 --membind=1 ../memoptest 0 >> /dev/null &
17 | sleep 1
18 | numactl --cpunodebind=0 --membind=1 ../memoptest 0 >> /dev/null &
19 | sleep 1
20 | numactl --cpunodebind=0 --membind=1 ../memoptest 0 >> /dev/null &
21 |
22 |
23 | echo "Press any key"
24 | read a
25 |
26 | numactl --cpunodebind=1 --membind=0 ../memoptest 0 >> /dev/null &
27 | sleep 1
28 | numactl --cpunodebind=1 --membind=0 ../memoptest 0 >> /dev/null &
29 | sleep 1
30 | numactl --cpunodebind=1 --membind=0 ../memoptest 0 >> /dev/null &
31 | sleep 1
32 | numactl --cpunodebind=1 --membind=0 ../memoptest 0 >> /dev/null &
33 | sleep 1
34 | numactl --cpunodebind=1 --membind=0 ../memoptest 0 >> /dev/null &
35 | sleep 1
36 | numactl --cpunodebind=1 --membind=0 ../memoptest 0 >> /dev/null &
37 | sleep 1
38 | numactl --cpunodebind=1 --membind=0 ../memoptest 0 >> /dev/null &
39 | sleep 1
40 | numactl --cpunodebind=1 --membind=0 ../memoptest 0 >> /dev/null &
41 | sleep 1
42 |
43 |
44 | echo "press any key to exit"
45 | read a
46 |
47 | killall memoptest
48 |
49 |
--------------------------------------------------------------------------------
/src/PCM-Service_Win/app.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #include "resource.h"
4 |
5 | #define APSTUDIO_READONLY_SYMBOLS
6 |
7 | /////////////////////////////////////////////////////////////////////////////
8 | #undef APSTUDIO_READONLY_SYMBOLS
9 |
10 | /////////////////////////////////////////////////////////////////////////////
11 | // English (U.S.) resources
12 |
13 |
14 | /////////////////////////////////////////////////////////////////////////////
15 | //
16 | // Icon
17 | //
18 |
19 | // Icon placed first or with lowest ID value becomes application icon
20 |
21 | LANGUAGE 9, 1
22 | #pragma code_page(1252)
23 | 1 ICON "app.ico"
24 |
25 | #ifdef APSTUDIO_INVOKED
26 | /////////////////////////////////////////////////////////////////////////////
27 | //
28 | // TEXTINCLUDE
29 | //
30 |
31 | 1 TEXTINCLUDE
32 | BEGIN
33 | "resource.h\0"
34 | "\0"
35 | END
36 |
37 | 2 TEXTINCLUDE
38 | BEGIN
39 | "#include ""afxres.h""\r\n"
40 | "\0"
41 | END
42 |
43 | 3 TEXTINCLUDE
44 | BEGIN
45 | "\0"
46 | END
47 |
48 | #endif // APSTUDIO_INVOKED
49 |
50 | /////////////////////////////////////////////////////////////////////////////
51 |
52 |
53 |
54 | #ifndef APSTUDIO_INVOKED
55 | /////////////////////////////////////////////////////////////////////////////
56 | //
57 | // Generated from the TEXTINCLUDE 3 resource.
58 | //
59 |
60 |
61 | /////////////////////////////////////////////////////////////////////////////
62 | #endif // not APSTUDIO_INVOKED
63 |
64 |
--------------------------------------------------------------------------------
/src/PCM-Service_Win/PCMInstaller.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | /*
14 | ** Written by Otto Bruggeman
15 | */
16 |
17 |
18 | #include "PCMInstaller.h"
19 |
--------------------------------------------------------------------------------
/src/MAC_HOWTO.txt:
--------------------------------------------------------------------------------
1 | Building and Installing
2 |
3 | Note: xcode is required to build the driver and dynamic library.
4 |
5 | Requirements
6 | ____________
7 | Building and installing requires make, gcc, and xcode.
8 | It has been tested on the following system configurations:
9 | OS X 10.7.4, Xcode 4.3.3, Apple LLVM compiler 3.1
10 | OS X 10.6.8, Xcode 4.2, Apple LLVM compiler 3.0
11 |
12 | Automatic Install
13 | -----------------
14 | In the MacMSRDriver directory run 'make install', which will build both the driver and dynamic library for accessing the driver.
15 | It loads the driver, installs the library into /usr/lib and installs the library headers into /usr/include.
16 |
17 | Manual Install
18 | --------------
19 | The driver and library can be built individually and without being installed using 'make kext' and 'make library' respectively.
20 | Once built, they are located in MacMSRDriver/build/Release. They can also be built by opening the PcmMsr project with xcode and building
21 | both projects.
22 |
23 | Then do the following:
24 | 1) load the driver by running kextload.sh
25 | 2) copy libPcmMsr.dylib to a location on your path (auto-install uses /usr/lib)
26 | 3) copy MSRKernel.h to a location on your path (auto-install uses /usr/include)
27 | 4) copy MSRAccessorPublic.h as MSRAccessor.h to a location on your path (auto-install uses /usr/include)
28 |
29 | PCM Binary Compilation
30 | ----------------------
31 |
32 | Once the driver and library have been built go to the root PCM directory (above MacMSRDriver) and execute "make".
33 | Now you can run ./pcm.x utility.
34 | See description of other built utilities in LINUX_HOWTO.txt
35 |
36 |
--------------------------------------------------------------------------------
/src/freegetopt/LICENSE:
--------------------------------------------------------------------------------
1 | Free Getopt
2 | Copyright (c)2002-2003 Mark K. Kim
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions
7 | are met:
8 |
9 | * Redistributions of source code must retain the above copyright
10 | notice, this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in
14 | the documentation and/or other materials provided with the
15 | distribution.
16 |
17 | * Neither the original author of this software nor the names of its
18 | contributors may be used to endorse or promote products derived
19 | from this software without specific prior written permission.
20 |
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29 | AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
31 | THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
32 | DAMAGE.
33 |
34 |
--------------------------------------------------------------------------------
/src/PCM_Win/pcm.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2011, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 |
14 | // pcm.cpp : Defines the entry point for the console application.
15 | //
16 |
17 | #include "stdafx.h"
18 |
19 | #include "../pcm.cpp"
20 |
--------------------------------------------------------------------------------
/src/Intelpcm.dll/Intelpcm.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 |
14 | /*
15 | ** Written by Otto Bruggeman
16 | */
17 |
18 | // Intelpcm.cpp : Defines the exported functions for the DLL application.
19 | //
20 |
21 |
22 | #include "Intelpcm.h"
23 |
24 |
25 |
--------------------------------------------------------------------------------
/src/WinMSRDriver/WinXP/msr.h:
--------------------------------------------------------------------------------
1 | #ifndef MSR_INCLUDED
2 | #define MSR_INCLUDED
3 | /*
4 | Copyright (c) 2009-2012, Intel Corporation
5 | All rights reserved.
6 |
7 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8 |
9 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12 |
13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14 | */
15 | /*
16 | written by Roman Dementiev
17 | */
18 |
19 |
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include "msrstruct.h"
25 |
26 |
27 | #endif
28 |
--------------------------------------------------------------------------------
/src/WinMSRDriver/Win7/msr.h:
--------------------------------------------------------------------------------
1 | #ifndef MSR_INCLUDED
2 | #define MSR_INCLUDED
3 |
4 | /*
5 | Copyright (c) 2009-2012, Intel Corporation
6 | All rights reserved.
7 |
8 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
9 |
10 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
11 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
13 |
14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15 | */
16 | /*
17 | written by Roman Dementiev
18 | */
19 |
20 |
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include "msrstruct.h"
26 |
27 |
28 | #endif
29 |
--------------------------------------------------------------------------------
/src/PCM_Win/stdafx.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2011, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 |
14 | // stdafx.cpp : source file that includes just the standard includes
15 | // pcm.pch will be the pre-compiled header
16 | // stdafx.obj will contain the pre-compiled type information
17 |
18 | #include "stdafx.h"
19 |
20 | // TODO: reference any additional headers you need in STDAFX.H
21 | // and not in this file
22 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/PcmMsr/PcmMsr-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleExecutable
8 | PcmMsrDriver
9 | CFBundleIdentifier
10 | com.intel.driver.PcmMsr
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | PcmMsrDriver
15 | CFBundlePackageType
16 | KEXT
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | IOKitPersonalities
24 |
25 | PcmMsrClient
26 |
27 | CFBundleIdentifier
28 | com.intel.driver.PcmMsr
29 | IOClass
30 | com_intel_driver_PcmMsr
31 | IOMatchCategory
32 | com_intel_driver_PcmMsr
33 | IOProbeScore
34 | 1000
35 | IOProviderClass
36 | IOResources
37 | IOResourceMatch
38 | IOKit
39 | IOUserClientClass
40 | com_intel_driver_PcmMsrClient
41 |
42 |
43 | OSBundleLibraries
44 |
45 | com.apple.kpi.bsd
46 | 10.8
47 | com.apple.kpi.mach
48 | 10.8
49 | com.apple.kpi.unsupported
50 | 10.8
51 | com.apple.kpi.iokit
52 | 10.8
53 | com.apple.kpi.libkern
54 | 10.8
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/src/freegetopt/README:
--------------------------------------------------------------------------------
1 | Free Getopt
2 |
3 | ******************************************************************************
4 | Please read the file LICENSE for the terms of use and distribution of this
5 | software.
6 | ******************************************************************************
7 |
8 | "getopt" is a library that allows a parsing of arguments passed
9 | to a program. This is a useful library used in many software.
10 | There are many versions of the getopt library available, two
11 | popular versions being the BSD getopt and the GNU getopt.
12 |
13 | BSD getopt is somewhat old, dated, and isn't very user-friendly.
14 | The GNU getopt is great, except the user license doesn't let you
15 | statically link the library to a proprietary software. This
16 | is usually not a problem on modern operating systems that allow
17 | dynamic links to libraries, but sometimes you just gotta link
18 | the library statically for one reason or another. That's where
19 | Free Getopt steps in.
20 |
21 | Functionally, this getopt library is equivalent to GNU's getopt
22 | library (the short option version, not the long one) in almost
23 | every aspect. The only exception is how the "optind" variable
24 | increments. Apparently due to different algorithms used by my
25 | program and the GNU getopt, the "optind" changes quite differently
26 | between our two software. I personally find my algorithm to be
27 | quite elegant; I couldn't tell you about the GNU version since
28 | I never looked at its source.
29 |
30 | GNU's getopt_long support is in progress.
31 |
32 | This library was deliberately left in non-library (not in
33 | *.lib, *.so, or *.a) form because it's most likely to be
34 | statically-linked in various platforms, and linking it
35 | directly from source is probably the most straight-forward
36 | way to use the software in any platform.
37 |
38 | I hope you find this software useful.
39 |
40 | Mark K. Kim
41 |
42 | $Header: /cvsroot/freegetopt/freegetopt/README,v 1.2 2003/10/26 03:10:19 vindaci Exp $
43 |
44 |
--------------------------------------------------------------------------------
/src/Makefile:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (c) 2009-2014 Intel Corporation
3 | # written by Roman Dementiev and Jim Harris
4 | #
5 |
6 | EXE = pcm-numa.x pcm-power.x pcm.x pcm-sensor.x pcm-msr.x pcm-memory.x pcm-tsx.x pcm-pcie.x
7 |
8 | all: $(EXE)
9 |
10 | CXXFLAGS += -Wall -g -O3
11 |
12 | # uncomment if you want to rely on Linux perf support (user needs CAP_SYS_ADMIN privileges)
13 | ifneq ($(wildcard /usr/include/linux/perf_event.h),)
14 | #CXXFLAGS += -DPCM_USE_PERF
15 | endif
16 |
17 | UNAME:=$(shell uname)
18 |
19 | ifeq ($(UNAME), Linux)
20 | LIB= -pthread -lrt
21 | endif
22 | ifeq ($(UNAME), Darwin)
23 | LIB= -lpthread /usr/lib/libPcmMsr.dylib
24 | CXXFLAGS += -I/usr/include
25 | endif
26 | ifeq ($(UNAME), FreeBSD)
27 | CXX=c++
28 | LIB= -lpthread -lc++
29 | endif
30 |
31 | COMMON_OBJS = msr.o cpucounters.o pci.o client_bw.o utils.o
32 | EXE_OBJS = $(EXE:.x=.o)
33 | OBJS = $(COMMON_OBJS) $(EXE_OBJS)
34 |
35 | # ensure 'make' does not delete the intermediate .o files
36 | .PRECIOUS: $(OBJS)
37 |
38 | -include $(OBJS:.o=.d)
39 | %.x: %.o $(COMMON_OBJS)
40 | $(CXX) -o $@ $^ $(LIB)
41 |
42 | %.o: %.cpp
43 | $(CXX) $(CXXFLAGS) -c $*.cpp -o $*.o
44 | @# the following lines generate dependency files for the
45 | @# target object
46 | @# from http://scottmcpeak.com/autodepend/autodepend.html
47 | $(CXX) -MM $(CXXFLAGS) $*.cpp > $*.d
48 | @# these sed/fmt commands modify the .d file to add a target
49 | @# rule for each .h and .cpp file with no dependencies;
50 | @# this will force 'make' to rebuild any objects that
51 | @# depend on a file that has been renamed rather than
52 | @# exiting with an error
53 | @mv -f $*.d $*.d.tmp
54 | @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
55 | @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
56 | sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
57 | @rm -f $*.d.tmp
58 |
59 | nice:
60 | 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
61 |
62 | clean:
63 | rm -rf *.x *.o *~ *.d
64 |
--------------------------------------------------------------------------------
/src/Intelpcm.dll/dllmain.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 |
14 | /*
15 | ** Written by Otto Bruggeman
16 | */
17 |
18 | // dllmain.cpp : Defines the entry point for the DLL application.
19 |
20 | #include
21 |
22 | BOOL APIENTRY DllMain( HMODULE hModule,
23 | DWORD ul_reason_for_call,
24 | LPVOID lpReserved
25 | )
26 | {
27 | switch (ul_reason_for_call)
28 | {
29 | case DLL_PROCESS_ATTACH:
30 | case DLL_THREAD_ATTACH:
31 | case DLL_THREAD_DETACH:
32 | case DLL_PROCESS_DETACH:
33 | break;
34 | }
35 | return TRUE;
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/src/PCM_Win/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | /*
7 | Copyright (c) 2009-2011, Intel Corporation
8 | All rights reserved.
9 |
10 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
11 |
12 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
13 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
14 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17 | */
18 |
19 | #pragma once
20 |
21 | #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
22 | #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
23 | #endif
24 |
25 | #include
26 | #include
27 |
28 |
29 | // TODO: reference additional headers your program requires here
30 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/MSRAccessorPublic.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Austen Ott
14 | //
15 | #ifndef MSRACCESSOR_HEADER
16 | #define MSRACCESSOR_HEADER
17 |
18 | #include
19 | #include
20 | class MSRAccessor{
21 | private:
22 | uint64_t num_cores;
23 | void closeConnection();
24 | public:
25 | MSRAccessor();
26 | int32_t read(uint32_t cpu_num, uint64_t msr_num, uint64_t * value);
27 | int32_t write(uint32_t cpu_num, uint64_t msr_num, uint64_t value);
28 | int32_t buildTopology(uint32_t num_cores, void*);
29 | uint32_t getNumInstances();
30 | uint32_t incrementNumInstances();
31 | uint32_t decrementNumInstances();
32 | ~MSRAccessor();
33 | };
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/src/WinMSRDriver/WinXP/msrstruct.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 |
14 | /*
15 | written by Roman Dementiev
16 | */
17 |
18 | #ifndef MSR_STRUCT_HEADER
19 | #define MSR_STRUCT_HEADER
20 |
21 |
22 | #ifndef CTL_CODE
23 | #include
24 | #endif
25 |
26 | #define MSR_DEV_TYPE 50000
27 |
28 | #define IO_CTL_MSR_READ CTL_CODE(MSR_DEV_TYPE, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS)
29 | #define IO_CTL_MSR_WRITE CTL_CODE(MSR_DEV_TYPE, 0x801, METHOD_BUFFERED, FILE_ANY_ACCESS)
30 |
31 | struct MSR_Request
32 | {
33 | int core_id;
34 | ULONG64 msr_address;
35 | ULONG64 write_value; /* value to write if write requet
36 | ignored if read request */
37 | };
38 |
39 |
40 | #endif
41 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/MSRAccessor.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Austen Ott
14 | //
15 | #include
16 | extern "C" {
17 | #include "DriverInterface.h"
18 | }
19 |
20 | class MSRAccessor{
21 | private:
22 | io_service_t service;
23 | io_connect_t connect;
24 | kern_return_t openConnection();
25 | void closeConnection();
26 | public:
27 | MSRAccessor();
28 | int32_t read(uint32_t cpu_num,uint64_t msr_num, uint64_t * value);
29 | int32_t write(uint32_t cpu_num, uint64_t msr_num, uint64_t value);
30 | int32_t buildTopology(uint32_t num_cores, void*);
31 |
32 | uint32_t getNumInstances();
33 | uint32_t incrementNumInstances();
34 | uint32_t decrementNumInstances();
35 | ~MSRAccessor();
36 | };
37 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/PcmMsr.xcodeproj/xcuserdata/aiott.xcuserdatad/xcschemes/PcmMsr.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
8 |
14 |
20 |
21 |
22 |
23 |
24 |
29 |
30 |
31 |
32 |
41 |
42 |
43 |
44 |
50 |
51 |
53 |
54 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/src/Intelpcm.dll/Intelpcm.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 |
14 | /*
15 | ** Written by Otto Bruggeman
16 | */
17 |
18 | // The following ifdef block is the standard way of creating macros which make exporting
19 | // from a DLL simpler. All files within this DLL are compiled with the INTELPCM_EXPORTS
20 | // symbol defined on the command line. this symbol should not be defined on any project
21 | // that uses this DLL. This way any other project whose source files include this file see
22 | // INTELPCM_API functions as being imported from a DLL, whereas this DLL sees symbols
23 | // defined with this macro as being exported.
24 | #ifdef INTELPCM_EXPORTS
25 | #define INTELPCM_API __declspec(dllexport)
26 | #else
27 | #define INTELPCM_API __declspec(dllimport)
28 | #endif
29 |
30 | #include "..\cpucounters.h"
31 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/PcmMsr.xcodeproj/xcuserdata/aiott.xcuserdatad/xcschemes/PcmMsrLibrary.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
4 |
7 |
8 |
14 |
20 |
21 |
22 |
23 |
24 |
29 |
30 |
31 |
32 |
41 |
42 |
43 |
44 |
50 |
51 |
53 |
54 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/src/freegetopt/getopt.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************
2 | * getopt.h - competent and free getopt library.
3 | * $Header: /cvsroot/freegetopt/freegetopt/getopt.h,v 1.2 2003/10/26 03:10:20 vindaci Exp $
4 | *
5 | * Copyright (c)2002-2003 Mark K. Kim
6 | * All rights reserved.
7 | *
8 | * Redistribution and use in source and binary forms, with or without
9 | * modification, are permitted provided that the following conditions
10 | * are met:
11 | *
12 | * * Redistributions of source code must retain the above copyright
13 | * notice, this list of conditions and the following disclaimer.
14 | *
15 | * * Redistributions in binary form must reproduce the above copyright
16 | * notice, this list of conditions and the following disclaimer in
17 | * the documentation and/or other materials provided with the
18 | * distribution.
19 | *
20 | * * Neither the original author of this software nor the names of its
21 | * contributors may be used to endorse or promote products derived
22 | * from this software without specific prior written permission.
23 | *
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
31 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
32 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
34 | * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
35 | * DAMAGE.
36 | */
37 | #ifndef GETOPT_H_
38 | #define GETOPT_H_
39 |
40 |
41 | #ifdef __cplusplus
42 | extern "C" {
43 | #endif
44 |
45 |
46 | extern char* optarg;
47 | extern int optind;
48 | extern int opterr;
49 | extern int optopt;
50 |
51 | int getopt(int argc, char** argv, char* optstr);
52 |
53 |
54 | #ifdef __cplusplus
55 | }
56 | #endif
57 |
58 |
59 | #endif /* GETOPT_H_ */
60 |
61 |
62 | /* vim:ts=3
63 | */
64 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/DriverInterface.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Austen Ott
14 | //
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include "PcmMsr/UserKernelShared.h"
20 |
21 | kern_return_t openMSRClient(io_connect_t connect);
22 | kern_return_t closeMSRClient(io_connect_t connect);
23 | kern_return_t readMSR(io_connect_t connect, pcm_msr_data_t* idata, size_t* idata_size, pcm_msr_data_t* odata, size_t* odata_size);
24 | kern_return_t writeMSR(io_connect_t connect, pcm_msr_data_t* data, size_t* data_size);
25 | kern_return_t getTopologyInfo(io_connect_t connect, topologyEntry* data, size_t* data_size);
26 | kern_return_t getNumClients(io_connect_t connect, uint32_t* num_insts);
27 | kern_return_t incrementNumClients(io_connect_t connect, uint32_t* num_insts);
28 | kern_return_t decrementNumClients(io_connect_t connect, uint32_t* num_insts);
--------------------------------------------------------------------------------
/src/winring0/OlsDef.h:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------------
2 | // Author : hiyohiyo
3 | // Mail : hiyohiyo@crystalmark.info
4 | // Web : http://openlibsys.org/
5 | // License : The modified BSD license
6 | //
7 | // Copyright 2007 OpenLibSys.org. All rights reserved.
8 | //-----------------------------------------------------------------------------
9 |
10 | #pragma once
11 |
12 | //-----------------------------------------------------------------------------
13 | //
14 | // DLL Status Code
15 | //
16 | //-----------------------------------------------------------------------------
17 |
18 | #define OLS_DLL_NO_ERROR 0
19 | #define OLS_DLL_UNSUPPORTED_PLATFORM 1
20 | #define OLS_DLL_DRIVER_NOT_LOADED 2
21 | #define OLS_DLL_DRIVER_NOT_FOUND 3
22 | #define OLS_DLL_DRIVER_UNLOADED 4
23 | #define OLS_DLL_DRIVER_NOT_LOADED_ON_NETWORK 5
24 | #define OLS_DLL_UNKNOWN_ERROR 9
25 |
26 | //-----------------------------------------------------------------------------
27 | //
28 | // Driver Type
29 | //
30 | //-----------------------------------------------------------------------------
31 |
32 | #define OLS_DRIVER_TYPE_UNKNOWN 0
33 | #define OLS_DRIVER_TYPE_WIN_9X 1
34 | #define OLS_DRIVER_TYPE_WIN_NT 2
35 | #define OLS_DRIVER_TYPE_WIN_NT4 3 // Obsolete
36 | #define OLS_DRIVER_TYPE_WIN_NT_X64 4
37 | #define OLS_DRIVER_TYPE_WIN_NT_IA64 5 // Reseved
38 |
39 | //-----------------------------------------------------------------------------
40 | //
41 | // PCI Error Code
42 | //
43 | //-----------------------------------------------------------------------------
44 |
45 | #define OLS_ERROR_PCI_BUS_NOT_EXIST (0xE0000001L)
46 | #define OLS_ERROR_PCI_NO_DEVICE (0xE0000002L)
47 | #define OLS_ERROR_PCI_WRITE_CONFIG (0xE0000003L)
48 | #define OLS_ERROR_PCI_READ_CONFIG (0xE0000004L)
49 |
50 | //-----------------------------------------------------------------------------
51 | //
52 | // Support Macros
53 | //
54 | //-----------------------------------------------------------------------------
55 |
56 | // Bus Number, Device Number and Function Number to PCI Device Address
57 | #define PciBusDevFunc(Bus, Dev, Func) ((Bus&0xFF)<<8) | ((Dev&0x1F)<<3) | (Func&7)
58 | // PCI Device Address to Bus Number
59 | #define PciGetBus(address) ((address>>8) & 0xFF)
60 | // PCI Device Address to Device Number
61 | #define PciGetDev(address) ((address>>3) & 0x1F)
62 | // PCI Device Address to Function Number
63 | #define PciGetFunc(address) (address&7)
64 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/MSRKernel.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Austen Ott
14 | //
15 | #define PcmMsrDriverClassName com_intel_driver_PcmMsr
16 | #define kPcmMsrDriverClassName "com_intel_driver_PcmMsr"
17 | #ifndef MSR_KERNEL_SHARED
18 | #define MSR_KERNEL_SHARED
19 | #include
20 | typedef struct {
21 | uint64_t value;
22 | uint32_t cpu_num;
23 | uint32_t msr_num;
24 | } pcm_msr_data_t;
25 |
26 | /*
27 | // The topologyEntry struct that is used by PCM
28 | typedef struct{
29 | uint32_t os_id;
30 | uint32_t socket;
31 | uint32_t core_id;
32 | } topologyEntry;
33 |
34 | // A kernel version of the topology entry structure. It has
35 | // an extra unused int to explicitly align the struct on a 64bit
36 | // boundary, preventing the compiler from adding extra padding.
37 | enum {
38 | kOpenDriver,
39 | kCloseDriver,
40 | kReadMSR,
41 | kWriteMSR,
42 | kBuildTopology,
43 | kGetNumInstances,
44 | kIncrementNumInstances,
45 | kDecrementNumInstances,
46 | kNumberOfMethods
47 | };
48 | */
49 | #endif
50 |
--------------------------------------------------------------------------------
/src/client_bw.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012-2013, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Roman Dementiev
14 | //
15 |
16 | #ifndef CPUCounters_CLIENTBW_H
17 | #define CPUCounters_CLIENTBW_H
18 |
19 | /*! \file client_bw.h
20 | \brief Interface to access client bandwidth counters
21 |
22 | */
23 |
24 | #include "types.h"
25 |
26 | #ifdef _MSC_VER
27 | #include "windows.h"
28 | #else
29 | #include
30 | #endif
31 |
32 | #define PCM_CLIENT_IMC_BAR_OFFSET (0x0048)
33 | #define PCM_CLIENT_IMC_DRAM_IO_REQESTS (0x5048)
34 | #define PCM_CLIENT_IMC_DRAM_DATA_READS (0x5050)
35 | #define PCM_CLIENT_IMC_DRAM_DATA_WRITES (0x5054)
36 | #define PCM_CLIENT_IMC_MMAP_SIZE (0x6000)
37 |
38 |
39 | class ClientBW
40 | {
41 | #if defined(__linux__) || defined(__FreeBSD__)
42 | int32 fd;
43 | char * mmapAddr;
44 | #endif
45 | #ifdef __APPLE__
46 | char * mmapAddr;
47 | #endif
48 |
49 | public:
50 | ClientBW();
51 |
52 | uint64 getImcReads();
53 | uint64 getImcWrites();
54 | uint64 getIoRequests();
55 |
56 | ~ClientBW();
57 | };
58 |
59 |
60 | #endif
61 |
--------------------------------------------------------------------------------
/src/WinMSRDriver/Win7/msrstruct.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 |
14 | /*
15 | written by Roman Dementiev
16 | */
17 |
18 | #ifndef MSR_STRUCT_HEADER
19 | #define MSR_STRUCT_HEADER
20 |
21 |
22 | #ifndef CTL_CODE
23 | #include
24 | #endif
25 |
26 | #define MSR_DEV_TYPE 50000
27 |
28 | #define IO_CTL_MSR_READ CTL_CODE(MSR_DEV_TYPE, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS)
29 | #define IO_CTL_MSR_WRITE CTL_CODE(MSR_DEV_TYPE, 0x801, METHOD_BUFFERED, FILE_ANY_ACCESS)
30 | #define IO_CTL_PCICFG_READ CTL_CODE(MSR_DEV_TYPE, 0x802, METHOD_BUFFERED, FILE_ANY_ACCESS)
31 | #define IO_CTL_PCICFG_WRITE CTL_CODE(MSR_DEV_TYPE, 0x803, METHOD_BUFFERED, FILE_ANY_ACCESS)
32 |
33 | struct MSR_Request
34 | {
35 | int core_id;
36 | ULONG64 msr_address;
37 | ULONG64 write_value; /* value to write if write requet
38 | ignored if read request */
39 | };
40 |
41 | struct PCICFG_Request
42 | {
43 | ULONG bus, dev, func, reg, bytes;
44 | // "bytes" can be only 4 or 8
45 | /* value to write if write request ignored if read request */
46 | ULONG64 write_value;
47 | };
48 |
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/PCIDriverInterface.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Patrick Konsor
14 | //
15 |
16 | #ifndef pci_driver_driverinterface_h
17 | #define pci_driver_driverinterface_h
18 |
19 | #ifdef __cplusplus
20 | extern "C" {
21 | #endif
22 |
23 | #define PCI_ENABLE 0x80000000
24 | #define FORM_PCI_ADDR(bus,dev,fun,off) (((PCI_ENABLE)) | \
25 | ((bus & 0xFF) << 16) | \
26 | ((dev & 0x1F) << 11) | \
27 | ((fun & 0x07) << 8) | \
28 | ((off & 0xFF) << 0))
29 |
30 | uint32_t PCIDriver_read32(uint32_t addr, uint32_t* val);
31 | uint32_t PCIDriver_read64(uint32_t addr, uint64_t* val);
32 | uint32_t PCIDriver_write32(uint32_t addr, uint32_t val);
33 | uint32_t PCIDriver_write64(uint32_t addr, uint64_t val);
34 | uint32_t PCIDriver_mapMemory(uint32_t address, uint8_t** virtual_address);
35 | uint32_t PCIDriver_unmapMemory(uint8_t* virtual_address);
36 | uint32_t PCIDriver_readMemory32(uint8_t* address, uint32_t* val);
37 | uint32_t PCIDriver_readMemory64(uint8_t* address, uint64_t* val);
38 |
39 | #ifdef __cplusplus
40 | }
41 | #endif
42 |
43 | #endif
44 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/PcmMsr/UserKernelShared.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Austen Ott
14 | //
15 | #define PcmMsrDriverClassName com_intel_driver_PcmMsr
16 | #define kPcmMsrDriverClassName "com_intel_driver_PcmMsr"
17 | #ifndef USER_KERNEL_SHARED
18 | #define USER_KERNEL_SHARED
19 | #include
20 | typedef struct {
21 | uint64_t value;
22 | uint32_t cpu_num;
23 | uint32_t msr_num;
24 | } pcm_msr_data_t;
25 |
26 | typedef struct {
27 | uint64_t value;
28 | uint32_t msr_num;
29 | bool mask;
30 | char padding[115];
31 | } k_pcm_msr_data_t;
32 |
33 | // The topologyEntry struct that is used by PCM
34 | typedef struct{
35 | uint32_t os_id;
36 | uint32_t socket;
37 | uint32_t core_id;
38 | } topologyEntry;
39 |
40 | // A kernel version of the topology entry structure. It has
41 | // an extra unused int to explicitly align the struct on a 64bit
42 | // boundary, preventing the compiler from adding extra padding.
43 | typedef struct{
44 | uint32_t os_id;
45 | uint32_t socket;
46 | uint32_t core_id;
47 | char padding[116];
48 | } kTopologyEntry;
49 |
50 | enum {
51 | kOpenDriver,
52 | kCloseDriver,
53 | kReadMSR,
54 | kWriteMSR,
55 | kBuildTopology,
56 | kGetNumInstances,
57 | kIncrementNumInstances,
58 | kDecrementNumInstances,
59 | // PCI functions
60 | kRead,
61 | kWrite,
62 | kMapMemory,
63 | kUnmapMemory,
64 | kReadMemory,
65 | kNumberOfMethods
66 | };
67 | #endif
--------------------------------------------------------------------------------
/src/PCM-Service_Win/AssemblyInfo.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | /*
14 | ** Written by Otto Bruggeman
15 | */
16 |
17 |
18 | using namespace System;
19 | using namespace System::Reflection;
20 | using namespace System::Runtime::CompilerServices;
21 | using namespace System::Runtime::InteropServices;
22 | using namespace System::Security::Permissions;
23 |
24 | //
25 | // General Information about an assembly is controlled through the following
26 | // set of attributes. Change these attribute values to modify the information
27 | // associated with an assembly.
28 | //
29 | [assembly:AssemblyTitleAttribute("PCMService")];
30 | [assembly:AssemblyDescriptionAttribute("")];
31 | [assembly:AssemblyConfigurationAttribute("")];
32 | [assembly:AssemblyCompanyAttribute("Intel GmbH")];
33 | [assembly:AssemblyProductAttribute("PCMService")];
34 | [assembly:AssemblyCopyrightAttribute("Copyright (c) Intel GmbH 2010")];
35 | [assembly:AssemblyTrademarkAttribute("")];
36 | [assembly:AssemblyCultureAttribute("")];
37 |
38 | //
39 | // Version information for an assembly consists of the following four values:
40 | //
41 | // Major Version
42 | // Minor Version
43 | // Build Number
44 | // Revision
45 | //
46 | // You can specify all the value or you can default the Revision and Build Numbers
47 | // by using the '*' as shown below:
48 |
49 | [assembly:AssemblyVersionAttribute("1.0.*")];
50 |
51 | [assembly:ComVisible(false)];
52 |
53 | [assembly:CLSCompliantAttribute(true)];
54 |
55 | [assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];
56 |
57 |
--------------------------------------------------------------------------------
/src/Intelpcm.dll/targetver.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 |
14 | /*
15 | ** Written by Otto Bruggeman
16 | */
17 |
18 | #pragma once
19 |
20 | // The following macros define the minimum required platform. The minimum required platform
21 | // is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run
22 | // your application. The macros work by enabling all features available on platform versions up to and
23 | // including the version specified.
24 |
25 | // Modify the following defines if you have to target a platform prior to the ones specified below.
26 | // Refer to MSDN for the latest info on corresponding values for different platforms.
27 | #ifndef WINVER // Specifies that the minimum required platform is Windows Vista.
28 | #define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows.
29 | #endif
30 |
31 | #ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
32 | #define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows.
33 | #endif
34 |
35 | #ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98.
36 | #define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
37 | #endif
38 |
39 | #ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0.
40 | #define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE.
41 | #endif
42 |
--------------------------------------------------------------------------------
/src/pcm3d/widget.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Roman Dementiev
14 | //
15 |
16 | #ifndef WIDGET_H
17 | #define WIDGET_H
18 |
19 | #include
20 | #include
21 |
22 | namespace Ui {
23 | class Widget;
24 | }
25 |
26 | class Widget : public QGLWidget
27 | {
28 | Q_OBJECT
29 |
30 | public:
31 | explicit Widget(QWidget *parent = 0);
32 | ~Widget();
33 |
34 | private:
35 | Ui::Widget *ui;
36 |
37 | GLfloat xRot, yRot, zRot, scale;
38 | QPoint lastPos;
39 |
40 | void draw3DBox(float x, float y, float z, const QColor & c);
41 | void drawWireFrame(float x, float y, float z);
42 | void drawCPU(float * height, QColor * colors, float power);
43 | void drawDIMMMs(float power);
44 | void drawPipe(float x, float y, float z, float fill,const QColor & c);
45 | void drawQPILink(float x, float y, float z, float fill1, float fill2,const QColor & c);
46 | void drawDIMMChannels(float ox, float oy, float oz, float x, float y, float z, float fill,const QColor & c);
47 | void drawAll();
48 |
49 | protected:
50 | void initializeGL();
51 | void resizeGL(int w, int h);
52 | void paintGL();
53 | void mousePressEvent(QMouseEvent *event);
54 | void mouseMoveEvent(QMouseEvent *event);
55 | void keyPressEvent(QKeyEvent *event);
56 |
57 | public slots:
58 | void setXRotation(int angle);
59 | void setYRotation(int angle);
60 | void setZRotation(int angle);
61 | void valueUpdate();
62 |
63 | signals:
64 | void xRotationChanged(int angle);
65 | void yRotationChanged(int angle);
66 | void zRotationChanged(int angle);
67 | };
68 |
69 | #endif // WIDGET_H
70 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/PcmMsr/PcmMsr.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Austen Ott
14 | //
15 | #include
16 | #include "UserKernelShared.h"
17 |
18 | class PcmMsrDriverClassName : public IOService
19 | {
20 | OSDeclareDefaultStructors(com_intel_driver_PcmMsr)
21 | public:
22 | // IOService methods
23 | virtual bool start(IOService* provider);
24 |
25 | virtual IOReturn writeMSR(pcm_msr_data_t* data);
26 | virtual IOReturn readMSR(pcm_msr_data_t* idata,pcm_msr_data_t* odata);
27 | virtual IOReturn buildTopology(topologyEntry* odata, uint32_t input_num_cores);
28 | virtual bool init(OSDictionary *dict);
29 | virtual void free(void);
30 | virtual bool handleOpen(IOService* forClient, IOOptionBits opts, void* args);
31 | virtual bool handleIsOpen(const IOService* forClient) const;
32 | virtual void handleClose(IOService* forClient, IOOptionBits opts);
33 |
34 | virtual uint32_t getNumCores();
35 |
36 | virtual IOReturn incrementNumInstances(uint32_t* num_instances);
37 | virtual IOReturn decrementNumInstances(uint32_t* num_instances);
38 | virtual IOReturn getNumInstances(uint32_t* num_instances);
39 |
40 | // PCI classes
41 | static uint32_t read(uint32_t pci_address);
42 | static void write(uint32_t pci_address, uint32_t value);
43 | void* mapMemory(uint32_t address, UInt8 **virtual_address);
44 | void unmapMemory(void* memory_map);
45 |
46 | private:
47 | // number of providers currently using the driver
48 | uint32_t num_clients = 0;
49 | uint32_t num_cores;
50 | kTopologyEntry *topologies;
51 | };
52 |
53 | #ifdef DEBUG
54 | #define _DEBUG 1
55 | #else
56 | #define _DEBUG 0
57 | #endif
58 | #define PRINT_DEBUG if (_DEBUG) IOLog
59 |
--------------------------------------------------------------------------------
/src/readmem.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Roman Dementiev
14 | //
15 |
16 | #include "cpucounters.h"
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 |
23 | using std::cout;
24 | using std::endl;
25 |
26 | inline double my_timestamp()
27 | {
28 | struct timeval tp;
29 | gettimeofday(&tp, NULL);
30 | return double(tp.tv_sec) + tp.tv_usec / 1000000.;
31 | }
32 |
33 | struct T
34 | {
35 | int key[1];
36 | int data[15];
37 |
38 | T() { }
39 | T(int a) { key[0] = a; }
40 |
41 | bool operator == (const T & k) const
42 | {
43 | return k.key[0] == key[0];
44 | }
45 | };
46 |
47 | template
48 | void Memory_intensive_task(DS & ds)
49 | {
50 | std::find(ds.begin(), ds.end(), ds.size());
51 | }
52 |
53 |
54 | int main(int argc, char * argv[])
55 | {
56 | std::vector vector;
57 | int nelements = 13000000;
58 |
59 | int i = 0;
60 | int delay = atoi(argv[1]);
61 |
62 | cout << "Elements data size: " << sizeof(T) * nelements / 1024 << " KB" << std::endl;
63 |
64 | for ( ; i < nelements; ++i)
65 | {
66 | vector.push_back(i);
67 | }
68 |
69 | double before_ts, after_ts;
70 |
71 |
72 | while (1)
73 | {
74 | before_ts = my_timestamp();
75 | cout << "Reading memory for " << delay << " seconds" << std::endl;
76 | do
77 | {
78 | Memory_intensive_task(vector);
79 | after_ts = my_timestamp();
80 | } while ((after_ts - before_ts) < delay);
81 |
82 |
83 | cout << "Sleeping for " << delay << " seconds" << std::endl;
84 | sleep(delay);
85 | }
86 |
87 |
88 | return 0;
89 | }
90 |
--------------------------------------------------------------------------------
/src/winring0/OlsApiInitExt.h:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------------
2 | // Author : hiyohiyo
3 | // Mail : hiyohiyo@crystalmark.info
4 | // Web : http://openlibsys.org/
5 | // License : The modified BSD license
6 | //
7 | // Copyright 2007-2009 OpenLibSys.org. All rights reserved.
8 | //-----------------------------------------------------------------------------
9 | // for WinRing0 1.3.x
10 |
11 | #pragma once
12 |
13 | #include "OlsApiInitDef.h"
14 |
15 | //-----------------------------------------------------------------------------
16 | //
17 | // Externs
18 | //
19 | //-----------------------------------------------------------------------------
20 |
21 | // DLL
22 | extern _GetDllStatus GetDllStatus;
23 | extern _GetDllVersion GetDllVersion;
24 | extern _GetDriverVersion GetDriverVersion;
25 | extern _GetDriverType GetDriverType;
26 |
27 | extern _InitializeOls InitializeOls;
28 | extern _DeinitializeOls DeinitializeOls;
29 |
30 | // CPU
31 | extern _IsCpuid IsCpuid;
32 | extern _IsMsr IsMsr;
33 | extern _IsTsc IsTsc;
34 |
35 | extern _Hlt Hlt;
36 | extern _Rdmsr Rdmsr;
37 | extern _Wrmsr Wrmsr;
38 | extern _Rdpmc Rdpmc;
39 | extern _Cpuid Cpuid;
40 | extern _Rdtsc Rdtsc;
41 |
42 | extern _HltTx HltTx;
43 | extern _RdmsrTx RdmsrTx;
44 | extern _WrmsrTx WrmsrTx;
45 | extern _RdpmcTx RdpmcTx;
46 | extern _CpuidTx CpuidTx;
47 | extern _RdtscTx RdtscTx;
48 |
49 | extern _HltPx HltPx;
50 | extern _RdmsrPx RdmsrPx;
51 | extern _WrmsrPx WrmsrPx;
52 | extern _RdpmcPx RdpmcPx;
53 | extern _CpuidPx CpuidPx;
54 | extern _RdtscPx RdtscPx;
55 |
56 | // I/O
57 | extern _ReadIoPortByte ReadIoPortByte;
58 | extern _ReadIoPortWord ReadIoPortWord;
59 | extern _ReadIoPortDword ReadIoPortDword;
60 |
61 | extern _ReadIoPortByteEx ReadIoPortByteEx;
62 | extern _ReadIoPortWordEx ReadIoPortWordEx;
63 | extern _ReadIoPortDwordEx ReadIoPortDwordEx;
64 |
65 | extern _WriteIoPortByte WriteIoPortByte;
66 | extern _WriteIoPortWord WriteIoPortWord;
67 | extern _WriteIoPortDword WriteIoPortDword;
68 |
69 | extern _WriteIoPortByteEx WriteIoPortByteEx;
70 | extern _WriteIoPortWordEx WriteIoPortWordEx;
71 | extern _WriteIoPortDwordEx WriteIoPortDwordEx;
72 |
73 | // PCI
74 | extern _SetPciMaxBusIndex SetPciMaxBusIndex;
75 |
76 | extern _ReadPciConfigByte ReadPciConfigByte;
77 | extern _ReadPciConfigWord ReadPciConfigWord;
78 | extern _ReadPciConfigDword ReadPciConfigDword;
79 |
80 | extern _ReadPciConfigByteEx ReadPciConfigByteEx;
81 | extern _ReadPciConfigWordEx ReadPciConfigWordEx;
82 | extern _ReadPciConfigDwordEx ReadPciConfigDwordEx;
83 |
84 | extern _WritePciConfigByte WritePciConfigByte;
85 | extern _WritePciConfigWord WritePciConfigWord;
86 | extern _WritePciConfigDword WritePciConfigDword;
87 |
88 | extern _WritePciConfigByteEx WritePciConfigByteEx;
89 | extern _WritePciConfigWordEx WritePciConfigWordEx;
90 | extern _WritePciConfigDwordEx WritePciConfigDwordEx;
91 |
92 | extern _FindPciDeviceById FindPciDeviceById;
93 | extern _FindPciDeviceByClass FindPciDeviceByClass;
94 |
95 | // Memory
96 | #ifdef _PHYSICAL_MEMORY_SUPPORT
97 | extern _ReadDmiMemory ReadDmiMemory;
98 | extern _ReadPhysicalMemory ReadPhysicalMemory;
99 | extern _WritePhysicalMemory WritePhysicalMemory;
100 | #endif
101 |
--------------------------------------------------------------------------------
/src/pcm3d/main.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Roman Dementiev
14 | //
15 |
16 | #include
17 | #include "widget.h"
18 | #include "../cpucounters.h"
19 | #include
20 | #include
21 | #include
22 |
23 | using std::endl;
24 | using std::cout;
25 |
26 | #ifdef _MSC_VER
27 | BOOL cleanup(DWORD)
28 | {
29 | PCM::getInstance()->cleanup();
30 | return FALSE;
31 | }
32 | #else
33 | void cleanup(int s)
34 | {
35 | signal(s, SIG_IGN);
36 | PCM::getInstance()->cleanup();
37 | exit(0);
38 | }
39 | #endif
40 |
41 | int main(int argc, char *argv[])
42 | {
43 | PCM * m = PCM::getInstance();
44 |
45 | signal(SIGINT, cleanup);
46 | signal(SIGKILL, cleanup);
47 | signal(SIGTERM, cleanup);
48 |
49 | PCM::ErrorCode status = m->program();
50 |
51 | switch (status)
52 | {
53 | case PCM::Success:
54 | break;
55 | case PCM::MSRAccessDenied:
56 | cout << "Access to Intel(r) Performance Counter Monitor has denied (no MSR or PCI CFG space access)." << endl;
57 | return -1;
58 | case PCM::PMUBusy:
59 | cout << "Access to Intel(r) Performance Counter Monitor has denied (Performance Monitoring Unit is occupied by other application). Try to stop the application that uses PMU." << endl;
60 | cout << "Alternatively you can try to reset PMU configuration at your own risk. Try to reset? (y/n)" << endl;
61 | char yn;
62 | std::cin >> yn;
63 | if ('y' == yn)
64 | {
65 | m->resetPMU();
66 | cout << "PMU configuration has been reset. Try to rerun the program again." << endl;
67 | }
68 | return -1;
69 | default:
70 | cout << "Access to Intel(r) Performance Counter Monitor has denied (Unknown error)." << endl;
71 | return -1;
72 | }
73 |
74 |
75 |
76 | if(m->getCPUModel() != PCM::JAKETOWN || m->getNumSockets()!=2 || m->getNumCores()!=32)
77 | {
78 | std::cout << "Unsupported platform/configuration" << std::endl;
79 | return -1;
80 | }
81 |
82 | QApplication a(argc, argv);
83 | Widget w;
84 | w.show();
85 |
86 | return a.exec();
87 | }
88 |
--------------------------------------------------------------------------------
/src/PCM-Service_Win/PCMService.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | /*
14 | ** Written by Otto Bruggeman and Roman Dementiev
15 | */
16 |
17 | // PCMService.cpp : main Windows Service project file.
18 |
19 | #include "PCMService.h"
20 |
21 | #include
22 | #include
23 | #include
24 |
25 | using namespace PCMServiceNS;
26 | using namespace System::Text;
27 | using namespace System::Security::Policy;
28 | using namespace System::Reflection;
29 |
30 | //To install/uninstall the service, type: "PMU Service.exe -Install [-u]"
31 | int _tmain(int argc, _TCHAR* argv[])
32 | {
33 | if (argc >= 2)
34 | {
35 | if (argv[1][0] == _T('/'))
36 | {
37 | argv[1][0] = _T('-');
38 | }
39 |
40 | if (_tcsicmp(argv[1], _T("-Install")) == 0)
41 | {
42 | array^ myargs = System::Environment::GetCommandLineArgs();
43 | array^ args = gcnew array(myargs->Length - 1);
44 |
45 | // Set args[0] with the full path to the assembly,
46 | Assembly^ assem = Assembly::GetExecutingAssembly();
47 | args[0] = assem->Location;
48 |
49 | Array::Copy(myargs, 2, args, 1, args->Length - 1);
50 | AppDomain^ dom = AppDomain::CreateDomain(L"execDom");
51 | Type^ type = System::Object::typeid;
52 | String^ path = type->Assembly->Location;
53 | StringBuilder^ sb = gcnew StringBuilder(path->Substring(0, path->LastIndexOf(L"\\")));
54 | sb->Append(L"\\InstallUtil.exe");
55 | dom->ExecuteAssembly(sb->ToString(), args);
56 | }
57 | else
58 | if (_tcsicmp(argv[1], _T("-Uninstall")) == 0)
59 | {
60 | array^ myargs = System::Environment::GetCommandLineArgs();
61 | array^ args = gcnew array(2);
62 |
63 | args[0] = L"-u";
64 |
65 | // Set args[0] with the full path to the assembly,
66 | Assembly^ assem = Assembly::GetExecutingAssembly();
67 | args[1] = assem->Location;
68 |
69 | AppDomain^ dom = AppDomain::CreateDomain(L"execDom");
70 | Type^ type = System::Object::typeid;
71 | String^ path = type->Assembly->Location;
72 | StringBuilder^ sb = gcnew StringBuilder(path->Substring(0, path->LastIndexOf(L"\\")));
73 | sb->Append(L"\\InstallUtil.exe");
74 | dom->ExecuteAssembly(sb->ToString(), args);
75 | }
76 |
77 | }
78 | else
79 | {
80 | ServiceBase::Run(gcnew PCMService);
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/msrtest.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Roman Dementiev
14 | // Austen Ott
15 |
16 | #include
17 | #include
18 | #include
19 | #include "msr.h"
20 |
21 | #define NUM_CORES 16
22 |
23 |
24 | int main()
25 | {
26 | uint32 i = 0;
27 | uint32 res;
28 | MsrHandle * cpu_msr[NUM_CORES];
29 |
30 | for (i = 0; i < NUM_CORES; ++i)
31 | {
32 | cpu_msr[i] = new MsrHandle(i);
33 | assert(cpu_msr >= 0);
34 |
35 | FixedEventControlRegister ctrl_reg;
36 | res = cpu_msr[i]->read(IA32_CR_FIXED_CTR_CTRL, &ctrl_reg.value);
37 | assert(res >= 0);
38 |
39 | ctrl_reg.fields.os0 = 1;
40 | ctrl_reg.fields.usr0 = 1;
41 | ctrl_reg.fields.any_thread0 = 0;
42 | ctrl_reg.fields.enable_pmi0 = 0;
43 |
44 | ctrl_reg.fields.os1 = 1;
45 | ctrl_reg.fields.usr1 = 1;
46 | ctrl_reg.fields.any_thread1 = 0;
47 | ctrl_reg.fields.enable_pmi1 = 0;
48 |
49 | ctrl_reg.fields.os2 = 1;
50 | ctrl_reg.fields.usr2 = 1;
51 | ctrl_reg.fields.any_thread2 = 0;
52 | ctrl_reg.fields.enable_pmi2 = 0;
53 |
54 | res = cpu_msr[i]->write(IA32_CR_FIXED_CTR_CTRL, ctrl_reg.value);
55 | assert(res >= 0);
56 |
57 | // start counting
58 | uint64 value = (1ULL << 0) + (1ULL << 1) + (1ULL << 2) + (1ULL << 3) + (1ULL << 32) + (1ULL << 33) + (1ULL << 34);
59 | res = cpu_msr[i]->write(IA32_CR_PERF_GLOBAL_CTRL, value);
60 | assert(res >= 0);
61 | }
62 | uint64 counters_before[NUM_CORES][3];
63 | uint64 counters_after[NUM_CORES][3];
64 |
65 | for (i = 0; i < NUM_CORES; ++i)
66 | {
67 | res = cpu_msr[i]->read(INST_RETIRED_ANY_ADDR, &counters_before[i][0]);
68 | assert(res >= 0);
69 | res = cpu_msr[i]->read(CPU_CLK_UNHALTED_THREAD_ADDR, &counters_before[i][1]);
70 | assert(res >= 0);
71 | res = cpu_msr[i]->read(CPU_CLK_UNHALTED_REF_ADDR, &counters_before[i][2]);
72 | assert(res >= 0);
73 | }
74 | //sleep for some time
75 | ::sleep(1);
76 | for (i = 0; i < NUM_CORES; ++i)
77 | {
78 | res = cpu_msr[i]->read(INST_RETIRED_ANY_ADDR, &counters_after[i][0]);
79 | assert(res >= 0);
80 | res = cpu_msr[i]->read(CPU_CLK_UNHALTED_THREAD_ADDR, &counters_after[i][1]);
81 | assert(res >= 0);
82 | res = cpu_msr[i]->read(CPU_CLK_UNHALTED_REF_ADDR, &counters_after[i][2]);
83 | assert(res >= 0);
84 | }
85 | for (i = 0; i < NUM_CORES; ++i)
86 | delete cpu_msr[i];
87 | for (i = 0; i < NUM_CORES; ++i)
88 | std::cout << "Core " << i <<
89 | "\t Instructions: " << (counters_after[i][0] - counters_before[i][0]) <<
90 | "\t Cycles: " << (counters_after[i][1] - counters_before[i][1]) <<
91 | "\t IPC: " << double(counters_after[i][0] - counters_before[i][0]) / double(counters_after[i][1] - counters_before[i][1]) << std::endl;
92 |
93 | }
94 |
--------------------------------------------------------------------------------
/src/PCM-Service_Win/PCMInstaller.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | /*
14 | ** Written by Otto Bruggeman
15 | */
16 |
17 | #pragma once
18 |
19 | using namespace System;
20 | using namespace System::ComponentModel;
21 | using namespace System::Collections;
22 | using namespace System::Configuration::Install;
23 |
24 |
25 | namespace PMUService {
26 |
27 | [RunInstaller(true)]
28 |
29 | ///
30 | /// Summary for ProjectInstaller
31 | ///
32 | public ref class ProjectInstaller : public System::Configuration::Install::Installer
33 | {
34 | public:
35 | ProjectInstaller(void)
36 | {
37 | InitializeComponent();
38 | //
39 | //TODO: Add the constructor code here
40 | //
41 | }
42 |
43 | protected:
44 | ///
45 | /// Clean up any resources being used.
46 | ///
47 | ~ProjectInstaller()
48 | {
49 | if (components)
50 | {
51 | delete components;
52 | }
53 | }
54 | private: System::ServiceProcess::ServiceProcessInstaller^ serviceProcessInstaller1;
55 | protected:
56 | private: System::ServiceProcess::ServiceInstaller^ serviceInstaller1;
57 |
58 | private:
59 | ///
60 | /// Required designer variable.
61 | ///
62 | System::ComponentModel::Container ^components;
63 |
64 | #pragma region Windows Form Designer generated code
65 | ///
66 | /// Required method for Designer support - do not modify
67 | /// the contents of this method with the code editor.
68 | ///
69 | void InitializeComponent(void)
70 | {
71 | this->serviceProcessInstaller1 = (gcnew System::ServiceProcess::ServiceProcessInstaller());
72 | this->serviceInstaller1 = (gcnew System::ServiceProcess::ServiceInstaller());
73 | //
74 | // serviceProcessInstaller1
75 | //
76 | this->serviceProcessInstaller1->Account = System::ServiceProcess::ServiceAccount::LocalSystem;
77 | this->serviceProcessInstaller1->Password = nullptr;
78 | this->serviceProcessInstaller1->Username = nullptr;
79 | //
80 | // serviceInstaller1
81 | //
82 | this->serviceInstaller1->Description = L"This service provides performance counters for perfmon to show hardware events ov"
83 | L"er time such as Clockticks, Instruction Retired, Cache Misses and Memory Bandwi"
84 | L"dth.";
85 | this->serviceInstaller1->DisplayName = L"Intel Performance Counter Monitor Service";
86 | this->serviceInstaller1->ServiceName = L"PCMService";
87 | this->serviceInstaller1->StartType = System::ServiceProcess::ServiceStartMode::Automatic;
88 | //
89 | // PCMInstaller
90 | //
91 | this->Installers->AddRange(gcnew cli::array< System::Configuration::Install::Installer^ >(2) {this->serviceProcessInstaller1,
92 | this->serviceInstaller1});
93 |
94 | }
95 | #pragma endregion
96 | };
97 | }
98 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/PcmMsr.xcodeproj/xcuserdata/aiott.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
16 |
17 |
27 |
28 |
38 |
39 |
51 |
52 |
64 |
65 |
77 |
78 |
90 |
91 |
103 |
104 |
105 |
106 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/MSRAccessor.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Austen Ott
14 | //
15 | #include "MSRAccessor.h"
16 | #include
17 | MSRAccessor::MSRAccessor(){
18 | service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching(kPcmMsrDriverClassName));
19 | openConnection();
20 | }
21 |
22 | int32_t MSRAccessor::buildTopology(uint32_t num_cores ,void* pTopos){
23 | topologyEntry *entries = (topologyEntry*)pTopos;
24 | size_t size = sizeof(topologyEntry)*num_cores;
25 | kern_return_t ret = getTopologyInfo(connect, entries, &size);
26 | return (ret == KERN_SUCCESS) ? 0 : -1;
27 | }
28 |
29 | int32_t MSRAccessor::read(uint32_t core_num, uint64_t msr_num, uint64_t * value){
30 | pcm_msr_data_t idatas, odatas;
31 | size_t size = sizeof(pcm_msr_data_t);
32 | idatas.msr_num = msr_num;
33 | idatas.cpu_num = core_num;
34 | kern_return_t ret = readMSR(connect, &idatas, &size, &odatas, &size);
35 | if(ret == KERN_SUCCESS)
36 | {
37 | *value = odatas.value;
38 | return sizeof(uint64_t);
39 | }
40 | else{
41 | return -1;
42 | }
43 | }
44 |
45 | int32_t MSRAccessor::write(uint32_t core_num, uint64_t msr_num, uint64_t value){
46 | pcm_msr_data_t idatas;
47 | size_t size = sizeof(pcm_msr_data_t);
48 | idatas.value = value;
49 | idatas.msr_num = msr_num;
50 | idatas.cpu_num = core_num;
51 | kern_return_t ret = writeMSR(connect, &idatas, &size);
52 | if(ret == KERN_SUCCESS)
53 | {
54 | return sizeof(uint64_t);
55 | }
56 | else
57 | {
58 | return -1;
59 | }
60 | }
61 |
62 | uint32_t MSRAccessor::getNumInstances(){
63 | uint32_t num_instances;
64 | getNumClients(connect, &num_instances);
65 | return num_instances;
66 | }
67 |
68 | uint32_t MSRAccessor::incrementNumInstances(){
69 | uint32_t num_instances;
70 | incrementNumClients(connect, &num_instances);
71 | return num_instances;
72 | }
73 |
74 | uint32_t MSRAccessor::decrementNumInstances(){
75 | uint32_t num_instances;
76 | decrementNumClients(connect, &num_instances);
77 | return num_instances;
78 | }
79 |
80 | MSRAccessor::~MSRAccessor(){
81 | closeConnection();
82 | }
83 |
84 | kern_return_t MSRAccessor::openConnection(){
85 | kern_return_t kernResult = IOServiceOpen(service, mach_task_self(), 0, &connect);
86 |
87 | if (kernResult != KERN_SUCCESS) {
88 | fprintf(stderr, "IOServiceOpen returned 0x%08x\n", kernResult);
89 | }
90 | else {
91 | kernResult = openMSRClient(connect);
92 |
93 | if (kernResult != KERN_SUCCESS) {
94 | fprintf(stderr, "openClient returned 0x%08x.\n\n", kernResult);
95 | }
96 | }
97 |
98 | return kernResult;
99 | }
100 |
101 | void MSRAccessor::closeConnection(){
102 | kern_return_t kernResult = closeMSRClient(connect);
103 | if (kernResult != KERN_SUCCESS) {
104 | fprintf(stderr, "closeClient returned 0x%08x.\n\n", kernResult);
105 | }
106 |
107 | kernResult = IOServiceClose(connect);
108 | if (kernResult != KERN_SUCCESS) {
109 | fprintf(stderr, "IOServiceClose returned 0x%08x\n\n", kernResult);
110 | }
111 | }
--------------------------------------------------------------------------------
/src/msr.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Roman Dementiev
14 | // Austen Ott
15 |
16 | #ifndef CPUCounters_MSR_H
17 | #define CPUCounters_MSR_H
18 |
19 | /*! \file msr.h
20 | \brief Low level interface to access hardware model specific registers
21 |
22 | Implemented and tested for Linux and 64-bit Windows 7
23 | */
24 |
25 | #include "types.h"
26 |
27 | #ifdef _MSC_VER
28 | #include "windows.h"
29 | #elif __APPLE__
30 | #include
31 | #endif
32 |
33 |
34 | class MsrHandle
35 | {
36 | #ifdef _MSC_VER
37 | HANDLE hDriver;
38 | #elif __APPLE__
39 | static MSRAccessor* driver;
40 | static int num_handles;
41 | #else
42 | int32 fd;
43 | #endif
44 | uint32 cpu_id;
45 | MsrHandle(); // forbidden
46 | MsrHandle(MsrHandle &); // forbidden
47 |
48 | public:
49 | MsrHandle(uint32 cpu);
50 | int32 read(uint64 msr_number, uint64 * value);
51 | int32 write(uint64 msr_number, uint64 value);
52 | int32 getCoreId() { return cpu_id; }
53 | #ifdef __APPLE__
54 | int32 buildTopology(uint32 num_cores, void*);
55 | uint32 getNumInstances();
56 | uint32 incrementNumInstances();
57 | uint32 decrementNumInstances();
58 | #endif
59 | virtual ~MsrHandle();
60 | };
61 |
62 | class SafeMsrHandle
63 | {
64 | MsrHandle * pHandle;
65 |
66 | SafeMsrHandle(SafeMsrHandle &); // forbidden
67 |
68 | public:
69 | SafeMsrHandle() : pHandle(NULL) {}
70 |
71 | SafeMsrHandle(uint32 core_id)
72 | {
73 | pHandle = new MsrHandle(core_id);
74 | }
75 |
76 | int32 read(uint64 msr_number, uint64 * value)
77 | {
78 | if(pHandle)
79 | return pHandle->read(msr_number, value);
80 |
81 | *value = 0;
82 |
83 | return sizeof(uint64);
84 | }
85 |
86 | int32 write(uint64 msr_number, uint64 value)
87 | {
88 | if(pHandle)
89 | return pHandle->write(msr_number, value);
90 |
91 | return sizeof(uint64);
92 | }
93 | int32 getCoreId()
94 | {
95 | if(pHandle)
96 | return pHandle->getCoreId();
97 |
98 | throw std::exception();
99 | return -1;
100 | }
101 | #ifdef __APPLE__
102 | int32 buildTopology(uint32 num_cores, void* p)
103 | {
104 | if(pHandle)
105 | return pHandle->buildTopology(num_cores,p);
106 |
107 | throw std::exception();
108 | return 0;
109 | }
110 | uint32 getNumInstances()
111 | {
112 | if(pHandle)
113 | return pHandle->getNumInstances();
114 |
115 | throw std::exception();
116 | return 0;
117 | }
118 | uint32 incrementNumInstances()
119 | {
120 | if(pHandle)
121 | return pHandle->incrementNumInstances();
122 |
123 | throw std::exception();
124 | return 0;
125 | }
126 | uint32 decrementNumInstances()
127 | {
128 | if(pHandle)
129 | return pHandle->decrementNumInstances();
130 |
131 | throw std::exception();
132 | return 0;
133 | }
134 | #endif
135 | virtual ~SafeMsrHandle()
136 | {
137 | if(pHandle)
138 | {
139 | delete pHandle;
140 | pHandle = NULL;
141 | }
142 | }
143 | };
144 |
145 | #endif
146 |
--------------------------------------------------------------------------------
/src/utils.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2013, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the dis
9 | tribution.
10 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11 |
12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNES
13 | S FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDI
14 | NG, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRI
15 | CT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16 | */
17 | // written by Roman Dementiev
18 |
19 |
20 | /*! \file utils.h
21 | \brief Some common utility routines
22 | */
23 |
24 | #ifndef PCM_UTILS_HEADER
25 | #define PCM_UTILS_HEADER
26 |
27 | #include
28 | #include
29 | #include
30 | #include "cpucounters.h"
31 |
32 | #ifndef _MSC_VER
33 | #include
34 | #include
35 | #include
36 | #endif
37 |
38 | void exit_cleanup(void);
39 | void set_signal_handlers(void);
40 | void restore_signal_handlers(void);
41 | #ifndef _MSC_VER
42 | void sigINT_handler(int signum);
43 | void sigHUP_handler(int signum);
44 | void sigUSR_handler(int signum);
45 | void sigSTOP_handler(int signum);
46 | void sigCONT_handler(int signum);
47 | #endif
48 |
49 | #ifdef _MSC_VER
50 | inline void win_usleep(int delay_us)
51 | {
52 | uint64 t1 = 0, t2 = 0, freq = 0;
53 | uint64 wait_tick;
54 | QueryPerformanceFrequency((LARGE_INTEGER *) &freq);
55 | wait_tick = freq * delay_us / 1000000ULL;
56 | QueryPerformanceCounter((LARGE_INTEGER *) &t1);
57 | do {
58 | QueryPerformanceCounter((LARGE_INTEGER *) &t2);
59 | YieldProcessor();
60 | } while ((t2-t1) < wait_tick);
61 | }
62 | #endif
63 |
64 | inline void MySleep(int delay)
65 | {
66 | #ifdef _MSC_VER
67 | if(delay) Sleep(delay*1000);
68 | #else
69 | ::sleep(delay);
70 | #endif
71 | }
72 |
73 | inline void MySleepMs(int delay_ms)
74 | {
75 | #ifdef _MSC_VER
76 | if(delay_ms) Sleep(delay_ms);
77 | #else
78 | struct timespec sleep_intrval;
79 | double complete_seconds;
80 | sleep_intrval.tv_nsec = static_cast(1000000000.0*(::modf(delay_ms/1000.0,&complete_seconds)));
81 | sleep_intrval.tv_sec = static_cast(complete_seconds);
82 | ::nanosleep(&sleep_intrval, NULL);
83 | #endif
84 | }
85 |
86 | inline void MySleepUs(int delay_us)
87 | {
88 | #ifdef _MSC_VER
89 | if(delay_us) win_usleep(delay_us);
90 | #else
91 | ::usleep(delay_us);
92 |
93 | #endif
94 | }
95 |
96 | void MySystem(char * sysCmd, char ** argc);
97 |
98 | struct null_stream : public std::streambuf
99 | {
100 | void overflow(char) { }
101 | };
102 |
103 | template
104 | inline std::string unit_format(IntType n)
105 | {
106 | char buffer[1024];
107 | if (n <= 9999ULL)
108 | {
109 | sprintf(buffer, "%4d ", int32(n));
110 | return buffer;
111 | }
112 | if (n <= 9999999ULL)
113 | {
114 | sprintf(buffer, "%4d K", int32(n / 1000ULL));
115 | return buffer;
116 | }
117 | if (n <= 9999999999ULL)
118 | {
119 | sprintf(buffer, "%4d M", int32(n / 1000000ULL));
120 | return buffer;
121 | }
122 | if (n <= 9999999999999ULL)
123 | {
124 | sprintf(buffer, "%4d G", int32(n / 1000000000ULL));
125 | return buffer;
126 | }
127 |
128 | sprintf(buffer, "%4d T", int32(n / (1000000000ULL * 1000ULL)));
129 | return buffer;
130 | }
131 |
132 |
133 | #define PCM_UNUSED(x) (void)(x)
134 |
135 | #define PCM_COMPILE_ASSERT(condition) \
136 | typedef char pcm_compile_assert_failed [ (condition) ? 1 : -1 ]; \
137 | pcm_compile_assert_failed pcm_compile_assert_failed_; \
138 | PCM_UNUSED(pcm_compile_assert_failed_);
139 |
140 | #endif
141 |
142 |
--------------------------------------------------------------------------------
/src/memoptest.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Roman Dementiev
14 | //
15 |
16 | #include "cpucounters.h"
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 |
25 | using std::cout;
26 | using std::endl;
27 |
28 | inline double my_timestamp()
29 | {
30 | struct timeval tp;
31 | gettimeofday(&tp, NULL);
32 | return double(tp.tv_sec) + tp.tv_usec / 1000000.;
33 | }
34 |
35 | struct T
36 | {
37 | int key[1];
38 | int data[3];
39 |
40 | T() { }
41 | T(int a) { key[0] = a; }
42 |
43 | bool operator == (const T & k) const
44 | {
45 | return k.key[0] == key[0];
46 | }
47 | };
48 |
49 |
50 | template
51 | void write_intensive_task(Y * p, Y * e, int value)
52 | {
53 | __m128i i = _mm_set_epi32(value, value, value, value);
54 |
55 | #if 0
56 | while (p != e)
57 | {
58 | *p = value;
59 | ++p;
60 | }
61 | #else
62 | while (p != e)
63 | {
64 | _mm_store_si128((__m128i *)p++, i);
65 | }
66 | #endif
67 | }
68 |
69 | template
70 | void stream_write_task(Y * p, Y * e, int value)
71 | {
72 | __m128i i = _mm_set_epi32(value, value, value, value);
73 |
74 | while (p != e)
75 | {
76 | _mm_stream_si128((__m128i *)p++, i);
77 | }
78 | }
79 |
80 | template
81 | void read_intensive_task(Y * p, Y * e, int value)
82 | {
83 | std::find(p, e, -1);
84 | }
85 |
86 |
87 | int main(int argc, char * argv[])
88 | {
89 | assert((argc > 1) && "Need operation type as parameter: 0 - read, 1 - write, 2 - streaming write ");
90 | int op = atoi(argv[1]);
91 | T * vector;
92 | int nelements = 13000000;
93 | vector = new T[nelements];
94 |
95 | int i = 0;
96 |
97 | cout << "Elements data size: " << sizeof(T) * nelements / 1024 << " KB" << std::endl;
98 |
99 | for ( ; i < nelements; ++i)
100 | {
101 | vector[i].key[0] = 10;
102 | }
103 |
104 | double before_ts, after_ts;
105 |
106 |
107 | while (1)
108 | {
109 | before_ts = my_timestamp();
110 | switch (op)
111 | {
112 | case 1:
113 | cout << "Writing memory" << std::endl;
114 | break;
115 | case 0:
116 | cout << "Reading memory" << std::endl;
117 | break;
118 | default:
119 | cout << "Streaming to memory" << std::endl;
120 | }
121 |
122 | int niter = 32;
123 | i = niter;
124 | int r = rand();
125 | while (i--)
126 | {
127 | switch (op)
128 | {
129 | case 1:
130 | write_intensive_task(vector, vector + nelements, r);
131 | break;
132 | case 0:
133 | read_intensive_task(vector, vector + nelements, r);
134 | break;
135 | default:
136 | stream_write_task(vector, vector + nelements, r);
137 | }
138 |
139 | after_ts = my_timestamp();
140 | }
141 | cout << "Bandwidth: " << (sizeof(T) * nelements * niter) / ((after_ts - before_ts) * 1024 * 1024) << " MByte/sec" << endl;
142 | }
143 |
144 | delete[] vector;
145 |
146 | return 0;
147 | }
148 |
--------------------------------------------------------------------------------
/src/pcm-msr.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 |
14 | // written by Roman Dementiev
15 | #define HACK_TO_REMOVE_DUPLICATE_ERROR
16 | #include "cpucounters.h"
17 | #ifdef _MSC_VER
18 | #pragma warning(disable : 4996) // for sprintf
19 | #include
20 | #include "../PCM_Win/windriver.h"
21 | #else
22 | #include
23 | #endif
24 | #include
25 | #include
26 | #include
27 | #include
28 | #ifdef _MSC_VER
29 | #include "freegetopt/getopt.h"
30 | #endif
31 |
32 | uint64 read_number(char * str)
33 | {
34 | std::istringstream stream(str);
35 | if(strstr(str,"x")) stream >> std::hex ;
36 | uint64 result = 0;
37 | stream >> result;
38 | return result;
39 | }
40 |
41 | void print_usage(const char * progname)
42 | {
43 | std::cout << "Usage "<= argc)
84 | {
85 | print_usage(argv[0]);
86 | return -1;
87 | }
88 |
89 | msr = (int) read_number(argv[optind]);
90 |
91 | #ifdef _MSC_VER
92 | // Increase the priority a bit to improve context switching delays on Windows
93 | SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
94 |
95 | TCHAR driverPath[1032];
96 | GetCurrentDirectory(1024, driverPath);
97 | wcscat_s(driverPath, 1032, L"\\msr.sys");
98 |
99 | // WARNING: This driver code (msr.sys) is only for testing purposes, not for production use
100 | Driver drv;
101 | // drv.stop(); // restart driver (usually not needed)
102 | if (!drv.start(driverPath))
103 | {
104 | std::cout << "Can not load MSR driver." << std::endl;
105 | std::cout << "You must have signed msr.sys driver in your current directory and have administrator rights to run this program" << std::endl;
106 | return -1;
107 | }
108 | #endif
109 |
110 | MsrHandle h(core);
111 | if(!dec) std::cout << std::hex << std::showbase;
112 | if(write)
113 | {
114 | std::cout << " Writing "<< value << " to MSR "<< msr << " on core "<< core << std::endl;
115 | h.write(msr,value);
116 | }
117 | value = 0;
118 | h.read(msr,&value);
119 | std::cout << " Read value "<< value << " from MSR "<< msr << " on core "<< core << "\n" << std::endl;
120 | }
121 |
--------------------------------------------------------------------------------
/src/pci.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Roman Dementiev
14 | // Pat Fay
15 | // Jim Harris (FreeBSD)
16 |
17 |
18 | #ifndef CPUCounters_PCI_H
19 | #define CPUCounters_PCI_H
20 |
21 | /*! \file pci.h
22 | \brief Low level interface to access PCI configuration space
23 |
24 | */
25 |
26 | #include "types.h"
27 |
28 | #ifdef _MSC_VER
29 | #include "windows.h"
30 | #else
31 | #include
32 | #endif
33 |
34 | #ifdef __APPLE__
35 | #include "PCIDriverInterface.h"
36 | #endif
37 |
38 | #include
39 |
40 | #define PCM_USE_PCI_MM_LINUX
41 |
42 | class PciHandle
43 | {
44 | #ifdef _MSC_VER
45 | HANDLE hDriver;
46 | #else
47 | int32 fd;
48 | #endif
49 |
50 | uint32 bus;
51 | uint32 device;
52 | uint32 function;
53 | #ifdef _MSC_VER
54 | DWORD pciAddress;
55 | #endif
56 |
57 | PciHandle(); // forbidden
58 | PciHandle(PciHandle &); // forbidden
59 |
60 | public:
61 | PciHandle(uint32 groupnr_, uint32 bus_, uint32 device_, uint32 function_);
62 |
63 | static bool exists(uint32 bus_, uint32 device_, uint32 function_);
64 |
65 | int32 read32(uint64 offset, uint32 * value);
66 | int32 write32(uint64 offset, uint32 value);
67 |
68 | int32 read64(uint64 offset, uint64 * value);
69 |
70 | virtual ~PciHandle();
71 | };
72 |
73 | #ifdef _MSC_VER
74 | typedef PciHandle PciHandleM;
75 | #elif __APPLE__
76 | // This may need to change if it can be implemented for OSX
77 | typedef PciHandle PciHandleM;
78 | #elif __FreeBSD__
79 | typedef PciHandle PciHandleM;
80 | #else
81 |
82 | // read/write PCI config space using physical memory
83 | class PciHandleM
84 | {
85 | #ifdef _MSC_VER
86 |
87 | #else
88 | int32 fd;
89 | #endif
90 |
91 | uint32 bus;
92 | uint32 device;
93 | uint32 function;
94 | uint64 base_addr;
95 |
96 | PciHandleM(); // forbidden
97 | PciHandleM(PciHandleM &); // forbidden
98 |
99 | public:
100 | PciHandleM(uint32 bus_, uint32 device_, uint32 function_);
101 |
102 | static bool exists(uint32 bus_, uint32 device_, uint32 function_);
103 |
104 | int32 read32(uint64 offset, uint32 * value);
105 | int32 write32(uint64 offset, uint32 value);
106 |
107 | int32 read64(uint64 offset, uint64 * value);
108 |
109 | virtual ~PciHandleM();
110 | };
111 |
112 | #ifndef _MSC_VER
113 |
114 | // read/write PCI config space using physical memory using mmaped file I/O
115 | class PciHandleMM
116 | {
117 | int32 fd;
118 | char * mmapAddr;
119 |
120 | uint32 bus;
121 | uint32 device;
122 | uint32 function;
123 | uint64 base_addr;
124 |
125 | #ifdef __linux__
126 | static MCFGHeader mcfgHeader;
127 | static std::vector mcfgRecords;
128 | static void readMCFG();
129 | #endif
130 |
131 | PciHandleMM(); // forbidden
132 | PciHandleMM(PciHandleM &); // forbidden
133 |
134 | public:
135 | PciHandleMM(uint32 groupnr_, uint32 bus_, uint32 device_, uint32 function_);
136 |
137 | static bool exists(uint32 bus_, uint32 device_, uint32 function_);
138 |
139 | int32 read32(uint64 offset, uint32 * value);
140 | int32 write32(uint64 offset, uint32 value);
141 |
142 | int32 read64(uint64 offset, uint64 * value);
143 |
144 | virtual ~PciHandleMM();
145 |
146 | #ifdef __linux__
147 | static const std::vector & getMCFGRecords();
148 | #endif
149 | };
150 |
151 | #ifdef PCM_USE_PCI_MM_LINUX
152 | #define PciHandleM PciHandleMM
153 | #endif
154 |
155 | #endif // _MSC_VER
156 |
157 | #endif
158 |
159 |
160 | #endif
161 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/PcmMsr/PcmMsrClient.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Austen Ott
14 | //
15 | #include
16 | #include
17 | #include "PcmMsr.h"
18 |
19 | #define PcmMsrClientClassName com_intel_driver_PcmMsrClient
20 |
21 | class PcmMsrClientClassName : public IOUserClient
22 | {
23 | OSDeclareDefaultStructors(com_intel_driver_PcmMsrClient)
24 |
25 | protected:
26 | PcmMsrDriverClassName* fProvider;
27 | static const IOExternalMethodDispatch sMethods[kNumberOfMethods];
28 |
29 | public:
30 | virtual bool start(IOService *provider);
31 |
32 | virtual IOReturn clientClose(void);
33 |
34 | virtual bool didTerminate(IOService* provider, IOOptionBits opts, bool* defer);
35 |
36 | protected:
37 | IOReturn checkActiveAndOpened (const char* memberFunction);
38 |
39 | virtual IOReturn externalMethod(uint32_t selector, IOExternalMethodArguments* arguments,
40 | IOExternalMethodDispatch* dispatch, OSObject* target, void* reference);
41 |
42 | static IOReturn sOpenDriver(PcmMsrClientClassName* target, void* reference, IOExternalMethodArguments* args);
43 | virtual IOReturn openUserClient(void);
44 |
45 | static IOReturn sCloseDriver(PcmMsrClientClassName* target, void* reference, IOExternalMethodArguments* args);
46 | virtual IOReturn closeUserClient(void);
47 |
48 | static IOReturn sReadMSR(PcmMsrClientClassName* target, void* reference, IOExternalMethodArguments* args);
49 | virtual IOReturn readMSR(pcm_msr_data_t* idata, pcm_msr_data_t* odata);
50 |
51 | static IOReturn sWriteMSR(PcmMsrClientClassName* target, void* reference, IOExternalMethodArguments* args);
52 | virtual IOReturn writeMSR(pcm_msr_data_t* data);
53 |
54 | static IOReturn sBuildTopology(PcmMsrClientClassName* target, void* reference, IOExternalMethodArguments* args);
55 | virtual IOReturn buildTopology(topologyEntry* data, size_t output_size);
56 |
57 | static IOReturn sGetNumInstances(PcmMsrClientClassName* target, void* reference, IOExternalMethodArguments* args);
58 | virtual IOReturn getNumInstances(uint32_t* num_insts);
59 |
60 | static IOReturn sIncrementNumInstances(PcmMsrClientClassName* target, void* reference, IOExternalMethodArguments* args);
61 | virtual IOReturn incrementNumInstances(uint32_t* num_insts);
62 |
63 | static IOReturn sDecrementNumInstances(PcmMsrClientClassName* target, void* reference, IOExternalMethodArguments* args);
64 | virtual IOReturn decrementNumInstances(uint32_t* num_insts);
65 |
66 | // PCI functions
67 | static IOReturn sRead(PcmMsrClientClassName* target, void* reference, IOExternalMethodArguments* arguments);
68 | virtual IOReturn read(const uint64_t* input, uint32_t inputSize, uint64_t* output, uint32_t outputSize);
69 |
70 | static IOReturn sWrite(PcmMsrClientClassName* target, void* reference, IOExternalMethodArguments* arguments);
71 | virtual IOReturn write(const uint64_t* input, uint32_t inputSize);
72 |
73 | static IOReturn sMapMemory(PcmMsrClientClassName* target, void* reference, IOExternalMethodArguments* arguments);
74 | virtual IOReturn mapMemory(const uint64_t* input, uint32_t inputSize, uint64_t* output, uint32_t outputSize);
75 |
76 | static IOReturn sUnmapMemory(PcmMsrClientClassName* target, void* reference, IOExternalMethodArguments* arguments);
77 | virtual IOReturn unmapMemory(const uint64_t* input, uint32_t inputSize);
78 |
79 | static IOReturn sReadMemory(PcmMsrClientClassName* target, void* reference, IOExternalMethodArguments* arguments);
80 | virtual IOReturn readMemory(const uint64_t* input, uint32_t inputSize, uint64_t* output, uint32_t outputSize);
81 | };
--------------------------------------------------------------------------------
/src/winring0/OlsApiInitDef.h:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------------
2 | // Author : hiyohiyo
3 | // Mail : hiyohiyo@crystalmark.info
4 | // Web : http://openlibsys.org/
5 | // License : The modified BSD license
6 | //
7 | // Copyright 2007-2009 OpenLibSys.org. All rights reserved.
8 | //-----------------------------------------------------------------------------
9 | // for WinRing0 1.3.x
10 |
11 | #pragma once
12 |
13 | //-----------------------------------------------------------------------------
14 | //
15 | // Type Defines
16 | //
17 | //-----------------------------------------------------------------------------
18 |
19 | // DLL
20 | typedef DWORD (WINAPI *_GetDllStatus) ();
21 | typedef DWORD (WINAPI *_GetDllVersion) (PBYTE major, PBYTE minor, PBYTE revision, PBYTE release);
22 | typedef DWORD (WINAPI *_GetDriverVersion) (PBYTE major, PBYTE minor, PBYTE revision, PBYTE release);
23 | typedef DWORD (WINAPI *_GetDriverType) ();
24 |
25 | typedef BOOL (WINAPI *_InitializeOls) ();
26 | typedef VOID (WINAPI *_DeinitializeOls) ();
27 |
28 | // CPU
29 | typedef BOOL (WINAPI *_IsCpuid) ();
30 | typedef BOOL (WINAPI *_IsMsr) ();
31 | typedef BOOL (WINAPI *_IsTsc) ();
32 |
33 | typedef BOOL (WINAPI *_Hlt) ();
34 | typedef DWORD (WINAPI *_Rdmsr) (DWORD index, PDWORD eax, PDWORD edx);
35 | typedef DWORD (WINAPI *_Wrmsr) (DWORD index, DWORD eax, DWORD edx);
36 | typedef DWORD (WINAPI *_Rdpmc) (DWORD index, PDWORD eax, PDWORD edx);
37 | typedef DWORD (WINAPI *_Cpuid) (DWORD index, PDWORD eax, PDWORD ebx, PDWORD ecx, PDWORD edx);
38 | typedef DWORD (WINAPI *_Rdtsc) (PDWORD eax, PDWORD edx);
39 |
40 | typedef BOOL (WINAPI *_HltTx) (DWORD_PTR threadAffinityMask);
41 | typedef DWORD (WINAPI *_RdmsrTx) (DWORD index, PDWORD eax, PDWORD edx, DWORD_PTR threadAffinityMask);
42 | typedef DWORD (WINAPI *_WrmsrTx) (DWORD index, DWORD eax, DWORD edx, DWORD_PTR threadAffinityMask);
43 | typedef DWORD (WINAPI *_RdpmcTx) (DWORD index, PDWORD eax, PDWORD edx, DWORD_PTR threadAffinityMask);
44 | typedef DWORD (WINAPI *_CpuidTx) (DWORD index, PDWORD eax, PDWORD ebx, PDWORD ecx, PDWORD edx, DWORD_PTR threadAffinityMask);
45 | typedef DWORD (WINAPI *_RdtscTx) (PDWORD eax, PDWORD edx, DWORD_PTR threadAffinityMask);
46 |
47 | typedef BOOL (WINAPI *_HltPx) (DWORD_PTR processAffinityMask);
48 | typedef DWORD (WINAPI *_RdmsrPx) (DWORD index, PDWORD eax, PDWORD edx, DWORD_PTR processAffinityMask);
49 | typedef DWORD (WINAPI *_WrmsrPx) (DWORD index, DWORD eax, DWORD edx, DWORD_PTR processAffinityMask);
50 | typedef DWORD (WINAPI *_RdpmcPx) (DWORD index, PDWORD eax, PDWORD edx, DWORD_PTR processAffinityMask);
51 | typedef DWORD (WINAPI *_CpuidPx) (DWORD index, PDWORD eax, PDWORD ebx, PDWORD ecx, PDWORD edx, DWORD_PTR processAffinityMask);
52 | typedef DWORD (WINAPI *_RdtscPx) (PDWORD eax, PDWORD edx, DWORD_PTR processAffinityMask);
53 |
54 | // I/O
55 | typedef BYTE (WINAPI *_ReadIoPortByte) (WORD address);
56 | typedef WORD (WINAPI *_ReadIoPortWord) (WORD address);
57 | typedef DWORD (WINAPI *_ReadIoPortDword) (WORD address);
58 |
59 | typedef BOOL (WINAPI *_ReadIoPortByteEx) (WORD address, PBYTE value);
60 | typedef BOOL (WINAPI *_ReadIoPortWordEx) (WORD address, PWORD value);
61 | typedef BOOL (WINAPI *_ReadIoPortDwordEx) (WORD address, PDWORD value);
62 |
63 | typedef VOID (WINAPI *_WriteIoPortByte) (WORD address, BYTE value);
64 | typedef VOID (WINAPI *_WriteIoPortWord) (WORD address, WORD value);
65 | typedef VOID (WINAPI *_WriteIoPortDword) (WORD address, DWORD value);
66 |
67 | typedef BOOL (WINAPI *_WriteIoPortByteEx) (WORD address, BYTE value);
68 | typedef BOOL (WINAPI *_WriteIoPortWordEx) (WORD address, WORD value);
69 | typedef BOOL (WINAPI *_WriteIoPortDwordEx) (WORD address, DWORD value);
70 |
71 | // PCI
72 | typedef VOID (WINAPI *_SetPciMaxBusIndex) (BYTE max);
73 |
74 | typedef BYTE (WINAPI *_ReadPciConfigByte) (DWORD pciAddress, BYTE regAddress);
75 | typedef WORD (WINAPI *_ReadPciConfigWord) (DWORD pciAddress, BYTE regAddress);
76 | typedef DWORD (WINAPI *_ReadPciConfigDword) (DWORD pciAddress, BYTE regAddress);
77 |
78 | typedef BOOL (WINAPI *_ReadPciConfigByteEx) (DWORD pciAddress, DWORD regAddress, PBYTE value);
79 | typedef BOOL (WINAPI *_ReadPciConfigWordEx) (DWORD pciAddress, DWORD regAddress, PWORD value);
80 | typedef BOOL (WINAPI *_ReadPciConfigDwordEx) (DWORD pciAddress, DWORD regAddress, PDWORD value);
81 |
82 | typedef VOID (WINAPI *_WritePciConfigByte) (DWORD pciAddress, BYTE regAddress, BYTE value);
83 | typedef VOID (WINAPI *_WritePciConfigWord) (DWORD pciAddress, BYTE regAddress, WORD value);
84 | typedef VOID (WINAPI *_WritePciConfigDword) (DWORD pciAddress, BYTE regAddress, DWORD value);
85 |
86 | typedef BOOL (WINAPI *_WritePciConfigByteEx) (DWORD pciAddress, DWORD regAddress, BYTE value);
87 | typedef BOOL (WINAPI *_WritePciConfigWordEx) (DWORD pciAddress, DWORD regAddress, WORD value);
88 | typedef BOOL (WINAPI *_WritePciConfigDwordEx) (DWORD pciAddress, DWORD regAddress, DWORD value);
89 |
90 | typedef DWORD (WINAPI *_FindPciDeviceById) (WORD vendorId, WORD deviceId, BYTE index);
91 | typedef DWORD (WINAPI *_FindPciDeviceByClass) (BYTE baseClass, BYTE subClass, BYTE programIf, BYTE index);
92 |
93 | // Memory
94 | #ifdef _PHYSICAL_MEMORY_SUPPORT
95 | typedef DWORD (WINAPI *_ReadDmiMemory) (PBYTE buffer, DWORD count, DWORD unitSize);
96 | typedef DWORD (WINAPI *_ReadPhysicalMemory) (DWORD_PTR address, PBYTE buffer, DWORD count, DWORD unitSize);
97 | typedef DWORD (WINAPI *_WritePhysicalMemory) (DWORD_PTR address, PBYTE buffer, DWORD count, DWORD unitSize);
98 | #endif
99 |
--------------------------------------------------------------------------------
/src/client_bw.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2013, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Roman Dementiev,
14 | // Patrick Konsor
15 | //
16 |
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include "pci.h"
27 | #include "client_bw.h"
28 |
29 | #ifndef _MSC_VER
30 | #include
31 | #include
32 | #endif
33 |
34 | #ifdef _MSC_VER
35 |
36 | #include
37 | #include "Winmsrdriver\win7\msrstruct.h"
38 | #include "winring0/OlsDef.h"
39 | #include "winring0/OlsApiInitExt.h"
40 |
41 | ClientBW::ClientBW()
42 | {
43 | std::cerr << "ClientBW class not implemented for Windows." << std::endl;
44 | throw std::exception();
45 | }
46 |
47 | uint64 ClientBW::getImcReads()
48 | {
49 | return 0;
50 | }
51 |
52 | uint64 ClientBW::getImcWrites()
53 | {
54 | return 0;
55 | }
56 |
57 | ClientBW::~ClientBW() {}
58 | uint64 ClientBW::getIoRequests()
59 | {
60 | return 0;
61 | }
62 |
63 |
64 | #elif __APPLE__
65 |
66 | #include "PCIDriverInterface.h"
67 |
68 | #define CLIENT_BUS 0
69 | #define CLIENT_DEV 0
70 | #define CLIENT_FUNC 0
71 | #define CLIENT_BAR_MASK 0x0007FFFFF8000LL
72 | #define CLIENT_EVENT_BASE 0x5000
73 |
74 | ClientBW::ClientBW()
75 | {
76 | uint64_t bar = 0;
77 | uint32_t pci_address = FORM_PCI_ADDR(CLIENT_BUS, CLIENT_DEV, CLIENT_FUNC, PCM_CLIENT_IMC_BAR_OFFSET);
78 | PCIDriver_read64(pci_address, &bar);
79 | uint64_t physical_address = (bar & CLIENT_BAR_MASK) + CLIENT_EVENT_BASE;//bar & (~(4096-1));
80 | mmapAddr = NULL;
81 | if (physical_address) {
82 | PCIDriver_mapMemory((uint32_t)physical_address, (uint8_t**)&mmapAddr);
83 | }
84 | }
85 |
86 | uint64 ClientBW::getImcReads()
87 | {
88 | uint32_t val = 0;
89 | PCIDriver_readMemory32((uint8_t*)mmapAddr + PCM_CLIENT_IMC_DRAM_DATA_READS - CLIENT_EVENT_BASE, &val);
90 | return (uint64_t)val;
91 | }
92 |
93 | uint64 ClientBW::getImcWrites()
94 | {
95 | uint32_t val = 0;
96 | PCIDriver_readMemory32((uint8_t*)mmapAddr + PCM_CLIENT_IMC_DRAM_DATA_WRITES - CLIENT_EVENT_BASE, &val);
97 | return (uint64_t)val;
98 | }
99 |
100 | uint64 ClientBW::getIoRequests()
101 | {
102 | uint32_t val = 0;
103 | PCIDriver_readMemory32((uint8_t*)mmapAddr + PCM_CLIENT_IMC_DRAM_IO_REQESTS - CLIENT_EVENT_BASE, &val);
104 | return (uint64_t)val;
105 | }
106 |
107 | ClientBW::~ClientBW() {
108 | PCIDriver_unmapMemory((uint8_t*)mmapAddr);
109 | }
110 |
111 | #else
112 |
113 | #if defined(__linux__) || defined(__FreeBSD__)
114 | // Linux implementation
115 |
116 | ClientBW::ClientBW() :
117 | fd(-1),
118 | mmapAddr(NULL)
119 | {
120 | int handle = ::open("/dev/mem", O_RDONLY);
121 | if (handle < 0) throw std::exception();
122 | fd = handle;
123 |
124 | PciHandleM imcHandle(0,0,0,0); // memory controller device coordinates: domain 0, bus 0, device 0, function 0
125 | uint64 imcbar = 0;
126 | imcHandle.read64(PCM_CLIENT_IMC_BAR_OFFSET, &imcbar);
127 | // std::cout << "DEBUG: imcbar="<= 0) ::close(fd);
164 | }
165 |
166 | #endif
167 |
168 | #endif
169 |
--------------------------------------------------------------------------------
/src/width_extender.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009-2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Roman Dementiev
14 | // Austen Ott
15 |
16 | #ifndef WIDTH_EXTENDER_HEADER_
17 | #define WIDTH_EXTENDER_HEADER_
18 |
19 | /*! \file width_extender.h
20 | \brief Provides 64-bit "virtual" counters from underlying 32-bit HW counters
21 | */
22 |
23 | #ifdef _MSC_VER
24 | #include
25 | #else
26 | #include
27 | #endif
28 |
29 | #include
30 | #include "cpucounters.h"
31 | #include "client_bw.h"
32 |
33 | #ifdef _MSC_VER
34 | DWORD WINAPI WatchDogProc(LPVOID state);
35 | #else
36 | void * WatchDogProc(void * state);
37 | #endif
38 |
39 | class CounterWidthExtender
40 | {
41 | public:
42 | struct AbstractRawCounter
43 | {
44 | virtual uint64 operator() () = 0;
45 | virtual ~AbstractRawCounter() {}
46 | };
47 |
48 | struct MsrHandleCounter : public AbstractRawCounter
49 | {
50 | SafeMsrHandle * msr;
51 | uint64 msr_addr;
52 | MsrHandleCounter(SafeMsrHandle * msr_, uint64 msr_addr_): msr(msr_), msr_addr(msr_addr_) {}
53 | uint64 operator() ()
54 | {
55 | uint64 value = 0;
56 | msr->read(msr_addr,&value);
57 | return value;
58 | }
59 | };
60 |
61 | struct ClientImcReadsCounter : public AbstractRawCounter
62 | {
63 | ClientBW * clientBW;
64 | ClientImcReadsCounter(ClientBW * clientBW_): clientBW(clientBW_) {}
65 | uint64 operator() () { return clientBW->getImcReads(); }
66 | };
67 |
68 | struct ClientImcWritesCounter : public AbstractRawCounter
69 | {
70 | ClientBW * clientBW;
71 | ClientImcWritesCounter(ClientBW * clientBW_): clientBW(clientBW_) {}
72 | uint64 operator() () { return clientBW->getImcWrites(); }
73 | };
74 |
75 | struct ClientIoRequestsCounter : public AbstractRawCounter
76 | {
77 | ClientBW * clientBW;
78 | ClientIoRequestsCounter(ClientBW * clientBW_): clientBW(clientBW_) {}
79 | uint64 operator() () { return clientBW->getIoRequests(); }
80 | };
81 |
82 | private:
83 |
84 | #ifdef _MSC_VER
85 | HANDLE UpdateThread;
86 | HANDLE CounterMutex;
87 | #else
88 | pthread_t UpdateThread;
89 | pthread_mutex_t CounterMutex;
90 | #endif
91 |
92 | AbstractRawCounter * raw_counter;
93 | uint64 extended_value;
94 | uint64 last_raw_value;
95 |
96 | CounterWidthExtender(); // forbidden
97 | CounterWidthExtender(CounterWidthExtender&); // forbidden
98 |
99 | uint64 internal_read()
100 | {
101 | if (this==NULL) return 0; // to make security check happy
102 | uint64 result = 0, new_raw_value = 0;
103 | #ifdef _MSC_VER
104 | WaitForSingleObject(CounterMutex,INFINITE);
105 | #else
106 | pthread_mutex_lock(&CounterMutex);
107 | #endif
108 | new_raw_value = (*raw_counter)();
109 | if(new_raw_value < last_raw_value)
110 | {
111 | extended_value += ((1ULL<<32ULL)-last_raw_value) + new_raw_value;
112 | }
113 | else
114 | {
115 | extended_value += (new_raw_value-last_raw_value);
116 | }
117 |
118 | last_raw_value = new_raw_value;
119 |
120 | result = extended_value;
121 | #ifdef _MSC_VER
122 | ReleaseMutex(CounterMutex);
123 | #else
124 | pthread_mutex_unlock(&CounterMutex);
125 | #endif
126 | return result;
127 | }
128 |
129 | public:
130 | CounterWidthExtender(AbstractRawCounter * raw_counter_): raw_counter(raw_counter_)
131 | {
132 | last_raw_value = (*raw_counter)();
133 | extended_value = last_raw_value;
134 |
135 | #ifdef _MSC_VER
136 | CounterMutex = CreateMutex(NULL,FALSE,NULL);
137 | UpdateThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)WatchDogProc,this,0,NULL);
138 | #else
139 | pthread_mutex_init(&CounterMutex, NULL);
140 | pthread_create(&UpdateThread, NULL, WatchDogProc, this);
141 | #endif
142 | }
143 | ~CounterWidthExtender()
144 | {
145 | #ifdef _MSC_VER
146 | TerminateThread(UpdateThread,0);
147 | CloseHandle(UpdateThread);
148 | CloseHandle(CounterMutex);
149 | #else
150 | pthread_cancel(UpdateThread);
151 | pthread_mutex_destroy(&CounterMutex);
152 | #endif
153 | if(raw_counter) delete raw_counter;
154 | }
155 |
156 | uint64 read() // read extended value
157 | {
158 | return internal_read();
159 | }
160 | };
161 |
162 |
163 | #endif
164 |
--------------------------------------------------------------------------------
/src/MacMSRDriver/DriverInterface.c:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012, Intel Corporation
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 | * Neither the name of Intel Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10 |
11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12 | */
13 | // written by Austen Ott
14 | //
15 |
16 | #include "DriverInterface.h"
17 |
18 | kern_return_t openMSRClient(io_connect_t connect)
19 | {
20 | kern_return_t kernResult;
21 |
22 | #if !defined(__LP64__)
23 | if (IOConnectCallScalarMethod != NULL) {
24 | #endif
25 | kernResult = IOConnectCallScalarMethod(connect, kOpenDriver, NULL, 0, NULL, NULL);
26 | #if !defined(__LP64__)
27 | }
28 | else {
29 | kernResult = IOConnectMethodScalarIScalarO(connect, kOpenDriver, 0, 0);
30 | }
31 | #endif
32 |
33 | return kernResult;
34 | }
35 |
36 | kern_return_t closeMSRClient(io_connect_t connect)
37 | {
38 |
39 | kern_return_t kernResult;
40 |
41 | #if !defined(__LP64__)
42 | if (IOConnectCallScalarMethod != NULL) {
43 | #endif
44 | kernResult = IOConnectCallScalarMethod(connect, kCloseDriver, NULL, 0, NULL, NULL);
45 | #if !defined(__LP64__)
46 | }
47 | else {
48 | kernResult = IOConnectMethodScalarIScalarO(connect, kCloseDriver, 0, 0);
49 | }
50 | #endif
51 |
52 | return kernResult;
53 | }
54 |
55 | kern_return_t readMSR(io_connect_t connect, pcm_msr_data_t* idata, size_t* idata_size,pcm_msr_data_t* odata, size_t* odata_size)
56 | {
57 |
58 | kern_return_t kernResult;
59 | #if !defined(__LP64__)
60 | if (IOConnectCallStructMethod != NULL) {
61 | #endif
62 | kernResult = IOConnectCallStructMethod(connect, kReadMSR, idata, *idata_size, odata, odata_size);
63 | #if !defined(__LP64__)
64 | }
65 | else {
66 | kernResult = IOConnectMethodStructIStructO(connect, kReadMSR, *idata_size, odata_size, idata, odata);
67 | }
68 | #endif
69 | return kernResult;
70 | }
71 |
72 | kern_return_t writeMSR(io_connect_t connect, pcm_msr_data_t* data, size_t* idata_size)
73 | {
74 | kern_return_t kernResult;
75 | #if !defined(__LP64__)
76 | if (IOConnectCallStructMethod != NULL) {
77 | #endif
78 | kernResult = IOConnectCallStructMethod(connect, kWriteMSR, (void*)data, *idata_size, NULL, NULL);
79 | #if !defined(__LP64__)
80 | }
81 | else {
82 | kernResult = IOConnectMethodStructIStructO(connect, kWriteMSR, *idata_size, NULL, data, NULL);
83 | }
84 | #endif
85 |
86 | return kernResult;
87 | }
88 |
89 | kern_return_t getTopologyInfo(io_connect_t connect, topologyEntry* data, size_t* data_size)
90 | {
91 | kern_return_t kernResult;
92 | #if !defined(__LP64__)
93 | if (IOConnectCallStructMethod != NULL) {
94 | #endif
95 | kernResult = IOConnectCallStructMethod(connect, kBuildTopology, NULL, 0, data, data_size);
96 | #if !defined(__LP64__)
97 | }
98 | else {
99 | kernResult = IOConnectMethodStructIStructO(connect, kBuildTopology, 0, data_size, NULL, data);
100 | }
101 | #endif
102 |
103 | return kernResult;
104 | }
105 |
106 | kern_return_t getNumClients(io_connect_t connect, uint32_t* num_insts)
107 | {
108 | kern_return_t kernResult;
109 | #if !defined(__LP64__)
110 | if (IOConnectCallStructMethod != NULL) {
111 | #endif
112 | uint32_t num_outputs = 1;
113 | uint64_t knum_insts;
114 | kernResult = IOConnectCallStructMethod(connect, kGetNumInstances, NULL, 0, &knum_insts, &num_outputs);
115 | *num_insts = (uint32_t)knum_insts;
116 | #if !defined(__LP64__)
117 | }
118 | else {
119 | kernResult = IOConnectMethodScalarIScalarO(connect, kGetNumInstances, 0, 1, NULL, num_insts);
120 | }
121 | #endif
122 |
123 | return kernResult;
124 | }
125 | kern_return_t incrementNumClients(io_connect_t connect, uint32_t* num_insts)
126 | {
127 | kern_return_t kernResult;
128 | #if !defined(__LP64__)
129 | if (IOConnectCallStructMethod != NULL) {
130 | #endif
131 | uint32_t num_outputs = 1;
132 | uint64_t knum_insts;
133 | kernResult = IOConnectCallStructMethod(connect, kIncrementNumInstances, NULL, 0, &knum_insts, &num_outputs);
134 | *num_insts = (uint32_t)knum_insts;
135 | #if !defined(__LP64__)
136 | }
137 | else {
138 | kernResult = IOConnectMethodScalarIScalarO(connect, kIncrementNumInstances, 0, 1, NULL, num_insts);
139 | }
140 | #endif
141 |
142 | return kernResult;
143 | }
144 |
145 | kern_return_t decrementNumClients(io_connect_t connect, uint32_t* num_insts)
146 | {
147 | kern_return_t kernResult;
148 | #if !defined(__LP64__)
149 | if (IOConnectCallStructMethod != NULL) {
150 | #endif
151 | uint32_t num_outputs = 1;
152 | uint64_t knum_insts;
153 | kernResult = IOConnectCallStructMethod(connect, kDecrementNumInstances, NULL, 0, &knum_insts, &num_outputs);
154 | *num_insts = (uint32_t)knum_insts;
155 | #if !defined(__LP64__)
156 | }
157 | else {
158 | kernResult = IOConnectMethodScalarIScalarO(connect, kDecrementNumInstances, 0, 1, NULL, num_insts);
159 | }
160 | #endif
161 |
162 | return kernResult;
163 | }
164 |
--------------------------------------------------------------------------------
/src/PCM-Service_Win/PCMService.resX:
--------------------------------------------------------------------------------
1 |
2 |
3 |
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 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | False
122 |
123 |
--------------------------------------------------------------------------------
/src/PCM-MSR_Win/pcm-msr-win.vcproj:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
25 |
28 |
31 |
34 |
37 |
40 |
52 |
55 |
58 |
61 |
69 |
72 |
75 |
78 |
81 |
84 |
87 |
90 |
93 |
94 |
102 |
105 |
108 |
111 |
114 |
117 |
126 |
129 |
132 |
135 |
145 |
148 |
151 |
154 |
157 |
160 |
163 |
166 |
169 |
170 |
171 |
172 |
173 |
174 |
179 |
182 |
183 |
186 |
187 |
190 |
191 |
194 |
195 |
198 |
199 |
202 |
203 |
206 |
207 |
210 |
211 |
212 |
217 |
220 |
221 |
224 |
225 |
228 |
229 |
232 |
233 |
236 |
237 |
240 |
241 |
244 |
245 |
248 |
249 |
250 |
255 |
256 |
259 |
262 |
263 |
264 |
267 |
268 |
269 |
270 |
271 |
272 |
--------------------------------------------------------------------------------
/src/PCM-TSX_Win/pcm-tsx-win.vcproj:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
25 |
28 |
31 |
34 |
37 |
40 |
52 |
55 |
58 |
61 |
69 |
72 |
75 |
78 |
81 |
84 |
87 |
90 |
93 |
94 |
102 |
105 |
108 |
111 |
114 |
117 |
126 |
129 |
132 |
135 |
145 |
148 |
151 |
154 |
157 |
160 |
163 |
166 |
169 |
170 |
171 |
172 |
173 |
174 |
179 |
182 |
183 |
186 |
187 |
190 |
191 |
194 |
195 |
198 |
199 |
202 |
203 |
206 |
207 |
210 |
211 |
212 |
217 |
220 |
221 |
224 |
225 |
228 |
229 |
232 |
233 |
236 |
237 |
240 |
241 |
244 |
245 |
248 |
249 |
250 |
255 |
256 |
259 |
262 |
263 |
264 |
267 |
268 |
269 |
270 |
271 |
272 |
--------------------------------------------------------------------------------
/src/PCM-NUMA_Win/pcm-numa-win.vcproj:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
25 |
28 |
31 |
34 |
37 |
40 |
52 |
55 |
58 |
61 |
69 |
72 |
75 |
78 |
81 |
84 |
87 |
90 |
93 |
94 |
102 |
105 |
108 |
111 |
114 |
117 |
126 |
129 |
132 |
135 |
145 |
148 |
151 |
154 |
157 |
160 |
163 |
166 |
169 |
170 |
171 |
172 |
173 |
174 |
179 |
182 |
183 |
186 |
187 |
190 |
191 |
194 |
195 |
198 |
199 |
202 |
203 |
206 |
207 |
210 |
211 |
212 |
217 |
220 |
221 |
224 |
225 |
228 |
229 |
232 |
233 |
236 |
237 |
240 |
241 |
244 |
245 |
248 |
249 |
250 |
255 |
256 |
259 |
262 |
263 |
264 |
267 |
268 |
269 |
270 |
271 |
272 |
--------------------------------------------------------------------------------
/src/PCM-PCIE_Win/pcm-pcie-win.vcproj:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
25 |
28 |
31 |
34 |
37 |
40 |
52 |
55 |
58 |
61 |
69 |
72 |
75 |
78 |
81 |
84 |
87 |
90 |
93 |
94 |
102 |
105 |
108 |
111 |
114 |
117 |
126 |
129 |
132 |
135 |
145 |
148 |
151 |
154 |
157 |
160 |
163 |
166 |
169 |
170 |
171 |
172 |
173 |
174 |
179 |
182 |
183 |
186 |
187 |
190 |
191 |
194 |
195 |
198 |
199 |
202 |
203 |
206 |
207 |
210 |
211 |
212 |
217 |
220 |
221 |
224 |
225 |
228 |
229 |
232 |
233 |
236 |
237 |
240 |
241 |
244 |
245 |
248 |
249 |
250 |
255 |
256 |
259 |
262 |
263 |
264 |
267 |
268 |
269 |
270 |
271 |
272 |
--------------------------------------------------------------------------------