Skip to content
This repository was archived by the owner on Feb 16, 2023. It is now read-only.

Commit 177cb76

Browse files
author
Stephanie Labasan
committed
Migrating updated libmsr code base with Doxygen documentation:
- Added more turbo functionality, specifically, turbo activation ratio and turbo ratio limits. - Added functionality to modify p-states. - Auto-formatting code base using astyle. - Created standard libmsr error handler. - Cleaning up powmon demoapp - should work with current libmsr version. - Refactoring msrmod tool to use getopt for command line parsing. Signed-off-by: Stephanie Labasan <[email protected]>
1 parent 917fff9 commit 177cb76

File tree

109 files changed

+13775
-10297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+13775
-10297
lines changed

.gitignore

+29-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
test/libmsr_test
2-
*.o
3-
*.so
4-
app
5-
cab*
6-
pebs
7-
*.core
81
*.btr
2+
*.core
3+
*.o
94
*.out
5+
*.so
106
*~
117
BUILD/
8+
CMakeCache.txt
9+
CMakeFiles/
10+
Makefile
1211
_autoconf_
12+
app
13+
cab*
14+
cmake_install.cmake
1315
demoapps/powmon/Makefile
1416
demoapps/powmon/Makefile.in
1517
demoapps/powmon/aclocal.m4
@@ -29,5 +31,25 @@ demoapps/powmon/src/power_wrapper_dynamic
2931
demoapps/powmon/src/power_wrapper_static
3032
demoapps/powmon/src/powmon
3133
demoapps/powmon/stamp-h1
34+
documentation/doxygen_*.pdf
35+
dox/html
36+
dox/latex
3237
headers/master.h
38+
include/CMakeFiles/
39+
include/Makefile
40+
include/cmake_install.cmake
3341
include/master.h
42+
install_manifest.txt
43+
lib/
44+
libmsr-config.cmake
45+
mpi_test
46+
pebs
47+
platform_headers/master.h
48+
test/dump-data
49+
test/libmsr-test
50+
test/libmsr_test
51+
test/pstate-test
52+
test/rapl-data
53+
test/translate
54+
test/turbo-test
55+
test/unit-test

CMakeLists.txt

+76-18
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,90 @@ if (NOT CMAKE_BUILD_TYPE)
1010
"Choose the type of build, options are: Debug Release RelWithDebInfo." FORCE)
1111
endif()
1212

13-
#
14-
# Add install RPATH to all executables & libraries.
15-
#
16-
#set(CMAKE_SKIP_BUILD_RPATH FALSE)
17-
#set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
18-
#set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
19-
#list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" index)
20-
#if (index LESS 0)
21-
# set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
22-
#endif()
23-
24-
# libmsr headers are in top level include directory
13+
# Headers are in top level include directory
2514
include_directories(${PROJECT_SOURCE_DIR}/include)
2615

27-
#Make libmsr findable
16+
# Make libmsr findable
2817
configure_file(
2918
${PROJECT_SOURCE_DIR}/libmsr-config.cmake.in
3019
${PROJECT_BINARY_DIR}/libmsr-config.cmake
31-
@ONLY)
20+
@ONLY
21+
)
3222

3323
install(FILES ${PROJECT_BINARY_DIR}/libmsr-config.cmake DESTINATION
34-
"${CMAKE_INSTALL_PREFIX}/share/cmake/libmsr")
24+
"${CMAKE_INSTALL_PREFIX}/share/cmake/libmsr"
25+
)
3526
install(EXPORT libmsr-libs DESTINATION
36-
"${CMAKE_INSTALL_PREFIX}/share/cmake/libmsr")
27+
"${CMAKE_INSTALL_PREFIX}/share/cmake/libmsr"
28+
)
29+
30+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
31+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
3732

3833
add_subdirectory(src)
3934
add_subdirectory(include)
40-
add_subdirectory(cmd)
41-
add_subdirectory(wrap)
35+
36+
find_package(Doxygen)
37+
if (DOXYGEN_FOUND)
38+
add_subdirectory(dox)
39+
endif(DOXYGEN_FOUND)
40+
41+
add_subdirectory(test)
42+
43+
add_custom_target(distclean
44+
rm -f CMakeCache.txt
45+
rm -f Makefile
46+
rm -f _autoconf_
47+
rm -f cmake_install.cmake
48+
rm -f demoapps/powmon/Makefile.in
49+
rm -f demoapps/powmon/aclocal.m4
50+
rm -f demoapps/powmon/config.h
51+
rm -f demoapps/powmon/config.h.in
52+
rm -f demoapps/powmon/config.log
53+
rm -f demoapps/powmon/config.status
54+
rm -f demoapps/powmon/configure
55+
rm -f demoapps/powmon/depcomp
56+
rm -f demoapps/powmon/install-sh
57+
rm -f demoapps/powmon/missing
58+
rm -f demoapps/powmon/src/Makefile.in
59+
rm -f demoapps/powmon/src/Makefile
60+
rm -f demoapps/powmon/src/power_wrapper_dynamic
61+
rm -f demoapps/powmon/src/power_wrapper_static
62+
rm -f demoapps/powmon/src/powmon
63+
rm -f demoapps/powmon/stamp-h1
64+
rm -f dox/CMakeCache.txt
65+
rm -f dox/Makefile
66+
rm -f dox/cmake_install.cmake
67+
rm -f include/Makefile
68+
rm -f include/cmake_install.cmake
69+
rm -f include/master.h
70+
rm -f install_manifest.txt
71+
rm -f libmsr-config.cmake
72+
rm -f msrmod/msrmod
73+
rm -f platform_headers/master.h
74+
rm -f src/Makefile
75+
rm -f src/cmake_install.cmake
76+
rm -f test/CMakeCache.txt
77+
rm -f test/Makefile
78+
rm -f test/cmake_install.cmake
79+
rm -f test/dump-data
80+
rm -f test/libmsr-test
81+
rm -f test/pstate-test
82+
rm -f test/rapl-data
83+
rm -f test/translate
84+
rm -f test/turbo-test
85+
rm -f test/unit-test
86+
rm -rf BUILD/
87+
rm -rf CMakeFiles/
88+
rm -rf demoapps/powmon/autom4te.cache/
89+
rm -rf demoapps/powmon/src/.deps/
90+
rm -rf dox/CMakeFiles/
91+
rm -rf dox/html/
92+
rm -rf dox/latex/
93+
rm -rf include/CMakeFiles/
94+
rm -rf lib/
95+
rm -rf src/CMakeFiles/
96+
rm -rf test/CMakeFiles/
97+
rm -rf wrap/CMakeFiles/
98+
COMMENT "Cleaning up unwanted files" VERBATIM
99+
)

README

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
LIBMSR
2+
======
3+
4+
Welcome to libmsr, a friendly (well, friendlier) interface to many of the
5+
model-specific registers in Intel processors. Now with PCI configuration
6+
register support for some Intel hardware.
7+
8+
version 0.2.0
9+
10+
11+
Last Update
12+
-----------
13+
18 August 2016
14+
15+
16+
Overview
17+
--------
18+
19+
Libmsr provides an interface to accessing the model-specific registers (MSRs)
20+
on Intel platforms, which provide privileged functionality for monitoring and
21+
controlling various CPU features.
22+
23+
24+
Installation
25+
------------
26+
27+
Installation is simple. You will need [cmake](http://www.cmake.org) version 2.8
28+
or higher and GCC. The old installation method is deprecated, you MUST use the
29+
script. In most cases, the installation is as follows:
30+
31+
install.sh [ /path/to/install ] [ -f arch_model ]
32+
33+
The install script can take two (optional) arguments. The first argument is the
34+
install directory. If a null or empty string is specified, then a BUILD/
35+
directory is automatically created in the top-level directory (i.e, where
36+
install.sh is launched from).
37+
38+
The second argument can explicitly tell the auto-configuration tool to use the
39+
header file of a specific architecture. To do this, simply add the following
40+
flag when executing the install script: "-f[architecture number]", where the
41+
architecture number is in hexadecimal.
42+
43+
Example:
44+
45+
I have an Ivy Bridge client processor which the auto-configuration tool does not
46+
detect. So, I will force the auto-configuration tool to use the Ivy Bridge
47+
header file defined in platform_headers/.
48+
49+
install.sh ~/build/libmsr -f3E
50+
51+
Currently supported architectures are Intel Xeon v1-3 (Sandy Bridge, Ivy
52+
Bridge, and Haswell server processors). The library technically supports all
53+
processors based on these architectures, but some features may be missing from
54+
client products. Using the wrong header file is likely to cause problems.
55+
56+
Supported Architectures:
57+
58+
2D (Sandy Bridge)
59+
3E (Ivy Bridge)
60+
3F (Haswell)
61+
62+
If you are unsure of your architecture number, check the "model" field in `lscpu`
63+
or `/proc/cpuinfo` (note that it won't be in hexadecimal).
64+
65+
66+
Notes
67+
-----
68+
69+
This software depends on the files `/dev/cpu/*/msr` being present with R/W
70+
permissions. Recent kernels require additional capabilities. We have found it
71+
easier to use our own [MSR-SAFE](https://github.com/LLNL/msr-safe) kernel
72+
module, but running as root (or going through the bother of adding the
73+
capabilities to the binaries) is another option.
74+
75+
If you need PCI configuration register (CSR) support in Libmsr, you MUST have
76+
CSR-SAFE installed. This code is not currently on Github -- you will need to
77+
request it.
78+
79+
Call `msr_init()` before using any of the APIs.
80+
81+
For sample code, see libmsr_test.c in the test/ directory.
82+
83+
Our most up-to-date documentation for Libmsr use is generated as part of the
84+
install script using Doxygen. There are also some useful PDF files in the
85+
documentation/ directory.
86+
87+
88+
Contributing
89+
------------
90+
91+
Code formatting can be automated using astyle with the following parameters:
92+
93+
astyle --style=allman --indent=spaces=4 -y -S -C -N <src_file>
94+
95+
96+
Contact
97+
-------
98+
99+
Stephanie Labasan, Developer <[email protected]>
100+
Scott Walker, Developer, <[email protected]>
101+
Kathleen Shoga, Developer, <[email protected]>
102+
Lauren Morita, Developer, <[email protected]>
103+
Barry Rountree, Project Lead <[email protected]>
104+
105+
We are in the process of migrating our bug tracking to Github. For now, please
106+
feel free to contact the authors with questions, problems, bugs, and feature
107+
requests.

0 commit comments

Comments
 (0)