|
Name |
|
Date |
Size |
#Lines |
LOC |
| .. | | 03-May-2022 | - |
| .github/workflows/ | H | 27-Sep-2021 | - | 158 | 124 |
| MacMSRDriver/ | H | 27-Sep-2021 | - | 2,595 | 2,076 |
| PCM-Core_Win/ | H | 27-Sep-2021 | - | 227 | 202 |
| PCM-IIO_Win/ | H | 27-Sep-2021 | - | 227 | 202 |
| PCM-LSPCI_Win/ | H | 27-Sep-2021 | - | 227 | 202 |
| PCM-Latency_Win/ | H | 27-Sep-2021 | - | 227 | 202 |
| PCM-Lib_Win/ | H | 03-May-2022 | - | 357 | 256 |
| PCM-MMIO_Win/ | H | 27-Sep-2021 | - | 229 | 204 |
| PCM-MSR_Win/ | H | 27-Sep-2021 | - | 227 | 202 |
| PCM-Memory_Win/ | H | 27-Sep-2021 | - | 227 | 202 |
| PCM-NUMA_Win/ | H | 27-Sep-2021 | - | 227 | 202 |
| PCM-PCICFG_Win/ | H | 27-Sep-2021 | - | 227 | 202 |
| PCM-PCIE_Win/ | H | 27-Sep-2021 | - | 227 | 202 |
| PCM-Power_Win/ | H | 03-May-2022 | - | 227 | 202 |
| PCM-Raw_Win/ | H | 27-Sep-2021 | - | 230 | 205 |
| PCM-Service_Win/ | H | 03-May-2022 | - | 1,491 | 1,049 |
| PCM-TSX_Win/ | H | 27-Sep-2021 | - | 224 | 199 |
| PCM_Win/ | H | 03-May-2022 | - | 556 | 399 |
| PMURegisterDeclarations/ | H | 27-Sep-2021 | - | 386 | 382 |
| WinMSRDriver/ | H | 27-Sep-2021 | - | 662 | 505 |
| daemon/ | H | 27-Sep-2021 | - | 2,587 | 2,026 |
| exceptions/ | H | 27-Sep-2021 | - | 23 | 8 |
| fedora/ | H | 27-Sep-2021 | - | 77 | 62 |
| freegetopt/ | H | 27-Sep-2021 | - | 431 | 241 |
| grafana/ | H | 27-Sep-2021 | - | 315 | 251 |
| winpmem/ | H | 03-May-2022 | - | 301 | 193 |
| winring0/ | H | 03-May-2022 | - | 1,167 | 678 |
| .bdsignore.all | H A D | 27-Sep-2021 | 342 | 34 | 33 |
| .codedocs | H A D | 27-Sep-2021 | 4.8 KiB | 197 | 188 |
| .gitattributes | H A D | 27-Sep-2021 | 117 | 7 | 5 |
| .gitignore | H A D | 27-Sep-2021 | 225 | 34 | 33 |
| CUSTOM-COMPILE-OPTIONS.md | H A D | 27-Sep-2021 | 772 | 16 | 10 |
| DOCKER_README.md | H A D | 27-Sep-2021 | 1 KiB | 13 | 9 |
| Dockerfile | H A D | 27-Sep-2021 | 269 | 12 | 8 |
| Doxyfile | H A D | 27-Sep-2021 | 49.9 KiB | 1,238 | 879 |
| ENVVAR_README.md | H A D | 27-Sep-2021 | 395 | 8 | 4 |
| FAQ.md | H A D | 27-Sep-2021 | 3.3 KiB | 73 | 42 |
| LICENSE | H A D | 27-Sep-2021 | 1.5 KiB | 30 | 23 |
| Makefile | H A D | 27-Sep-2021 | 5.1 KiB | 161 | 116 |
| PCM-EXPORTER.md | H A D | 27-Sep-2021 | 1.8 KiB | 32 | 22 |
| PCM-SENSOR-SERVER-README.md | H A D | 27-Sep-2021 | 3.9 KiB | 47 | 38 |
| PCM_RAW_README.md | H A D | 27-Sep-2021 | 10.2 KiB | 130 | 108 |
| README.md | H A D | 27-Sep-2021 | 7.8 KiB | 96 | 71 |
| WINDOWS_HOWTO.md | H A D | 27-Sep-2021 | 3.3 KiB | 52 | 27 |
| build_solution.bat | H A D | 27-Sep-2021 | 512 | 13 | 7 |
| bw.cpp | H A D | 27-Sep-2021 | 6.5 KiB | 180 | 144 |
| bw.h | H A D | 27-Sep-2021 | 3 KiB | 79 | 47 |
| c_example.c | H A D | 27-Sep-2021 | 3.6 KiB | 127 | 107 |
| convert_edp_list.sh | H A D | 27-Sep-2021 | 51 | 5 | 1 |
| cppcheck.sh | H A D | 27-Sep-2021 | 188 | 12 | 7 |
| cpuasynchcounter.h | H A D | 27-Sep-2021 | 7.2 KiB | 214 | 159 |
| cpucounters.cpp | H A D | 27-Sep-2021 | 275.3 KiB | 7,622 | 6,548 |
| cpucounters.h | H A D | 27-Sep-2021 | 142.5 KiB | 3,883 | 2,508 |
| dashboard.cpp | H A D | 03-May-2022 | 24.1 KiB | 743 | 702 |
| dashboard.h | H A D | 27-Sep-2021 | 1.7 KiB | 23 | 6 |
| dashboardtest.cpp | H A D | 27-Sep-2021 | 1.6 KiB | 22 | 7 |
| debug.cpp | H A D | 27-Sep-2021 | 1.7 KiB | 43 | 8 |
| debug.h | H A D | 27-Sep-2021 | 3.5 KiB | 91 | 48 |
| docker-compose.yml | H A D | 27-Sep-2021 | 446 | 17 | 16 |
| favicon.ico.h | H A D | 27-Sep-2021 | 1.8 KiB | 21 | 20 |
| lspci.h | H A D | 27-Sep-2021 | 15.8 KiB | 465 | 416 |
| memoptest.cpp | H A D | 27-Sep-2021 | 4.1 KiB | 149 | 109 |
| mmio.cpp | H A D | 27-Sep-2021 | 8.8 KiB | 281 | 229 |
| mmio.h | H A D | 27-Sep-2021 | 4.8 KiB | 161 | 127 |
| msr.cpp | H A D | 27-Sep-2021 | 7.2 KiB | 268 | 204 |
| msr.h | H A D | 27-Sep-2021 | 4.3 KiB | 154 | 106 |
| msrtest.cpp | H A D | 27-Sep-2021 | 4 KiB | 93 | 64 |
| mutex.h | H A D | 27-Sep-2021 | 1.1 KiB | 71 | 63 |
| pci.cpp | H A D | 27-Sep-2021 | 19.1 KiB | 720 | 550 |
| pci.h | H A D | 27-Sep-2021 | 4.6 KiB | 171 | 104 |
| pcm-all.sln | H A D | 27-Sep-2021 | 12.5 KiB | 182 | 180 |
| pcm-bw-histogram.sh | H A D | 27-Sep-2021 | 2.3 KiB | 66 | 48 |
| pcm-core.cpp | H A D | 27-Sep-2021 | 17.6 KiB | 583 | 492 |
| pcm-exporter | H A D | 27-Sep-2021 | 39 | 5 | 1 |
| pcm-iio.cpp | H A D | 27-Sep-2021 | 48.6 KiB | 1,263 | 1,087 |
| pcm-latency.cpp | H A D | 27-Sep-2021 | 18.3 KiB | 544 | 457 |
| pcm-lspci.cpp | H A D | 27-Sep-2021 | 5.2 KiB | 121 | 96 |
| pcm-memory.cpp | H A D | 27-Sep-2021 | 51.5 KiB | 1,233 | 1,113 |
| pcm-mmio.cpp | H A D | 27-Sep-2021 | 4.7 KiB | 127 | 100 |
| pcm-msr.cpp | H A D | 27-Sep-2021 | 5.1 KiB | 147 | 119 |
| pcm-numa.cpp | H A D | 27-Sep-2021 | 11.4 KiB | 315 | 245 |
| pcm-pcicfg.cpp | H A D | 27-Sep-2021 | 4.6 KiB | 119 | 90 |
| pcm-pcie.cpp | H A D | 27-Sep-2021 | 10.7 KiB | 270 | 213 |
| pcm-pcie.h | H A D | 27-Sep-2021 | 24.3 KiB | 813 | 689 |
| pcm-power.cpp | H A D | 27-Sep-2021 | 25.6 KiB | 500 | 428 |
| pcm-raw.cpp | H A D | 27-Sep-2021 | 52.3 KiB | 1,285 | 1,167 |
| pcm-sensor-server.cpp | H A D | 27-Sep-2021 | 126.5 KiB | 3,253 | 2,703 |
| pcm-sensor.cpp | H A D | 27-Sep-2021 | 31.5 KiB | 685 | 607 |
| pcm-tsx.cpp | H A D | 27-Sep-2021 | 29.8 KiB | 601 | 518 |
| pcm.cpp | H A D | 27-Sep-2021 | 56.6 KiB | 1,380 | 1,197 |
| pcm.spec | H A D | 27-Sep-2021 | 1.8 KiB | 73 | 62 |
| pmu-query.py | H A D | 27-Sep-2021 | 3.7 KiB | 100 | 88 |
| readmem.cpp | H A D | 27-Sep-2021 | 2.9 KiB | 90 | 55 |
| readmem.sh | H A D | 27-Sep-2021 | 615 | 16 | 12 |
| realtime.cpp | H A D | 27-Sep-2021 | 8.4 KiB | 286 | 192 |
| resctrl.cpp | H A D | 27-Sep-2021 | 6.1 KiB | 146 | 129 |
| resctrl.h | H A D | 27-Sep-2021 | 2.3 KiB | 53 | 30 |
| simdjson_wrapper.cpp | H A D | 27-Sep-2021 | 114 | 6 | 4 |
| simdjson_wrapper.h | H A D | 27-Sep-2021 | 600 | 21 | 18 |
| threadpool.cpp | H A D | 27-Sep-2021 | 1.7 KiB | 46 | 11 |
| threadpool.h | H A D | 27-Sep-2021 | 4 KiB | 152 | 94 |
| topology.cpp | H A D | 27-Sep-2021 | 5.1 KiB | 131 | 67 |
| topology.h | H A D | 27-Sep-2021 | 16.6 KiB | 573 | 416 |
| types.h | H A D | 27-Sep-2021 | 44.5 KiB | 1,267 | 941 |
| utils.cpp | H A D | 27-Sep-2021 | 18.5 KiB | 594 | 434 |
| utils.h | H A D | 27-Sep-2021 | 12 KiB | 451 | 370 |
| version.h | H A D | 27-Sep-2021 | 62 | 2 | 1 |
| width_extender.h | H A D | 27-Sep-2021 | 6.6 KiB | 179 | 127 |
README.md
1--------------------------------------------------------------------------------
2Processor Counter Monitor (PCM)
3--------------------------------------------------------------------------------
4
5[PCM Tools](#pcm-tools) | [Building PCM](#building-pcm-tools) | [Downloading Pre-Compiled PCM](#downloading-pre-compiled-pcm-tools) | [FAQ](#frequently-asked-questions-faq) | [API Documentation](#pcm-api-documentation) | [Environment Variables](#pcm-environment-variables) | [Compilation Options](#custom-compilation-options)
6
7Processor Counter Monitor (PCM) is an application programming interface (API) and a set of tools based on the API to monitor performance and energy metrics of Intel® Core™, Xeon®, Atom™ and Xeon Phi™ processors. PCM works on Linux, Windows, Mac OS X, FreeBSD and DragonFlyBSD operating systems.
8
9*Github repository statistics:* ![Custom badge](https://img.shields.io/endpoint?url=https%3A%2F%2Fhetthbszh0.execute-api.us-east-2.amazonaws.com%2Fdefault%2Fpcm-clones) ![Custom badge](https://img.shields.io/endpoint?url=https%3A%2F%2F5urjfrshcd.execute-api.us-east-2.amazonaws.com%2Fdefault%2Fpcm-yesterday-clones) ![Custom badge](https://img.shields.io/endpoint?url=https%3A%2F%2Fcsqqh18g3l.execute-api.us-east-2.amazonaws.com%2Fdefault%2Fpcm-today-clones)
10
11--------------------------------------------------------------------------------
12Current Build Status
13--------------------------------------------------------------------------------
14
15- Linux and OSX: [![Build Status](https://travis-ci.com/opcm/pcm.svg?branch=master)](https://travis-ci.com/opcm/pcm)
16- Windows: [![Build status](https://ci.appveyor.com/api/projects/status/github/opcm/pcm?branch=master&svg=true)](https://ci.appveyor.com/project/opcm/pcm)
17- FreeBSD: [![Build Status](https://api.cirrus-ci.com/github/opcm/pcm.svg)](https://cirrus-ci.com/github/opcm/pcm)
18- Docker Hub: [![Build status](https://img.shields.io/docker/cloud/build/opcm/pcm.svg)](https://github.com/opcm/pcm/blob/master/DOCKER_README.md) [![pulls](https://img.shields.io/docker/pulls/opcm/pcm.svg)](https://github.com/opcm/pcm/blob/master/DOCKER_README.md)
19
20--------------------------------------------------------------------------------
21PCM Tools
22--------------------------------------------------------------------------------
23
24PCM provides a number of command-line utilities for real-time monitoring:
25
26- **pcm** : basic processor monitoring utility (instructions per cycle, core frequency (including Intel(r) Turbo Boost Technology), memory and Intel(r) Quick Path Interconnect bandwidth, local and remote memory bandwidth, cache misses, core and CPU package sleep C-state residency, core and CPU package thermal headroom, cache utilization, CPU and memory energy consumption)
27![pcm output](https://raw.githubusercontent.com/wiki/opcm/pcm/pcm.x.jpg)
28- **pcm-sensor-server** : pcm collector exposing metrics over http in JSON or Prometheus (exporter text based) format ([how-to](https://github.com/opcm/pcm/blob/master/PCM-EXPORTER.md)). Also available as a [docker container](https://github.com/opcm/pcm/blob/master/DOCKER_README.md)
29- **pcm-memory** : monitor memory bandwidth (per-channel and per-DRAM DIMM rank)
30![pcm-memory output](https://raw.githubusercontent.com/wiki/opcm/pcm/pcm-memory.x.JPG)
31- **pcm-latency** : monitor L1 cache miss and DDR/PMM memory latency
32- **pcm-pcie** : monitor PCIe bandwidth per-socket
33- **pcm-iio** : monitor PCIe bandwidth per PCIe device
34![pcm-iio output](https://raw.githubusercontent.com/wiki/opcm/pcm/pcm-iio.png)
35- **pcm-numa** : monitor local and remote memory accesses
36- **pcm-power** : monitor sleep and energy states of processor, Intel(r) Quick Path Interconnect, DRAM memory, reasons of CPU frequency throttling and other energy-related metrics
37- **pcm-tsx**: monitor performance metrics for Intel(r) Transactional Synchronization Extensions
38- **pcm-core** and **pmu-query**: query and monitor arbitrary processor core events
39- **pcm-raw**: [program arbitrary **core** and **uncore** events by specifying raw register event ID encoding](https://github.com/opcm/pcm/blob/master/PCM_RAW_README.md)
40- **pcm-bw-histogram**: collect memory bandwidth utilization histogram
41
42Graphical front ends:
43- **pcm Grafana dashboard** : front-end for Grafana (in [grafana](https://github.com/opcm/pcm/tree/master/grafana) directory)
44![pcm grafana output](https://raw.githubusercontent.com/wiki/opcm/pcm/pcm-dashboard.png)
45- **pcm-sensor** : front-end for KDE KSysGuard
46- **pcm-service** : front-end for Windows perfmon
47
48There are also utilities for reading/writing model specific registers (**pcm-msr**), PCI configuration registers (**pcm-pcicfg**) and memory mapped registers (**pcm-mmio**) supported on Linux, Windows, Mac OS X and FreeBSD.
49
50And finally a daemon that stores core, memory and QPI counters in shared memory that can be be accessed by non-root users.
51
52--------------------------------------------------------------------------------
53Building PCM Tools
54--------------------------------------------------------------------------------
55
56- Linux: just type 'make'. You will get all the utilities (pcm.x, pcm-memory.x, etc) built in the main PCM directory.
57- FreeBSD/DragonFlyBSD: just type 'gmake'. You will get all the utilities (pcm.x, pcm-memory.x, etc) built in the main PCM directory. If the 'gmake' command is not available, you need to install GNU make from ports (for example with 'pkg install gmake').
58- Windows: follow the steps in [WINDOWS_HOWTO.md](https://github.com/opcm/pcm/blob/master/WINDOWS_HOWTO.md) (will need to build or download additional drivers).
59- Mac OS X: follow instructions in [MAC_HOWTO.txt](https://github.com/opcm/pcm/blob/master/MAC_HOWTO.txt)
60
61--------------------------------------------------------------------------------
62Downloading Pre-Compiled PCM Tools
63--------------------------------------------------------------------------------
64
65- Linux:
66 * openSUSE: `sudo zypper install pcm`
67 * Fedora: `sudo yum install pcm`
68 * RPMs and DEBs with the *latest* PCM version for RHEL/SLE/Ubuntu/Debian/openSUSE/etc distributions (binary and source) are available [here](https://software.opensuse.org/download/package?package=pcm&project=home%3Aopcm)
69- Windows: download PCM binaries as [appveyor build service](https://ci.appveyor.com/project/opcm/pcm/history) artifacts and required Visual C++ Redistributable from [www.microsoft.com](https://www.microsoft.com/en-us/download/details.aspx?id=48145). Additional drivers are needed, see [WINDOWS_HOWTO.md](https://github.com/opcm/pcm/blob/master/WINDOWS_HOWTO.md).
70- Docker: see [instructions on how to use pcm-sensor-server pre-compiled container from docker hub](https://github.com/opcm/pcm/blob/master/DOCKER_README.md).
71
72--------------------------------------------------------------------------------
73Frequently Asked Questions (FAQ)
74--------------------------------------------------------------------------------
75
76PCM's frequently asked questions (FAQ) are located [here](https://github.com/opcm/pcm/blob/master/FAQ.md).
77
78--------------------------------------------------------------------------------
79PCM API documentation
80--------------------------------------------------------------------------------
81
82PCM API documentation is embedded in the source code and can be generated into html format from source using Doxygen (www.doxygen.org).
83
84--------------------------------------------------------------------------------
85PCM environment variables
86--------------------------------------------------------------------------------
87
88The list of PCM environment variables is located [here](https://github.com/opcm/pcm/blob/master/ENVVAR_README.md)
89
90--------------------------------------------------------------------------------
91Custom compilation options
92--------------------------------------------------------------------------------
93The list of custom compilation options is located [here](https://github.com/opcm/pcm/blob/master/CUSTOM-COMPILE-OPTIONS.md)
94
95
96
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 <iostream>
18 #include <algorithm>
19 #include <list>
20 #include <vector>
21 #include <sys/time.h>
22
23 using std::cout;
24
my_timestamp()25 inline double my_timestamp()
26 {
27 struct timeval tp;
28 gettimeofday(&tp, NULL);
29 return double(tp.tv_sec) + tp.tv_usec / 1000000.;
30 }
31
32 struct T
33 {
34 int key[1] = { 0 };
35 int data[15] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
36
TT37 T() { }
TT38 T(int a) { key[0] = a; }
39
operator ==T40 bool operator == (const T & k) const
41 {
42 return k.key[0] == key[0];
43 }
44 };
45
46 template <class DS>
Memory_intensive_task(DS & ds)47 void Memory_intensive_task(DS & ds)
48 {
49 // cppcheck-suppress ignoredReturnValue
50 std::find(ds.begin(), ds.end(), ds.size());
51 }
52
53
main(int argc,char * argv[])54 int main(int argc, char * argv[])
55 {
56 std::vector<T> 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\n";
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\n" << flush;
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\n" << flush;
84 sleep(delay);
85 }
86
87
88 return 0;
89 }
90
readmem.sh