Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
9d77eae5
Commit
9d77eae5
authored
Feb 21, 2019
by
Micha Mueller
Browse files
Add printConfig method to MSR plugin
parent
3919c08c
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/sensors/msr/MSRConfigurator.cpp
View file @
9d77eae5
...
...
@@ -16,10 +16,7 @@ MSRConfigurator::~MSRConfigurator() {}
void
MSRConfigurator
::
sensorBase
(
MSRSensorBase
&
s
,
CFG_VAL
config
)
{
ADD
{
if
(
boost
::
iequals
(
val
.
first
,
"delta"
))
{
//it is explicitly stated to be off --> set it to false
s
.
setDelta
(
!
(
val
.
second
.
data
()
==
"off"
)
);
}
else
if
(
boost
::
iequals
(
val
.
first
,
"metric"
)){
if
(
boost
::
iequals
(
val
.
first
,
"metric"
)){
s
.
setMetric
(
std
::
stoull
(
val
.
second
.
data
(),
nullptr
,
16
));
}
}
...
...
src/sensors/msr/MSRSensorBase.h
View file @
9d77eae5
...
...
@@ -14,7 +14,8 @@ class MSRSensorBase : public SensorBase {
public:
MSRSensorBase
(
const
std
::
string
&
name
)
:
SensorBase
(
name
),
_cpu
(
0
),
_metric
(
0
)
{
//default delta to true, as msr has only monotonic sensors usually
_delta
=
true
;
}
MSRSensorBase
(
const
MSRSensorBase
&
other
)
=
default
;
...
...
@@ -40,6 +41,11 @@ public:
_metric
=
metric
;
}
void
printConfig
(
LOG_LEVEL
ll
,
LOGGER
&
lg
)
{
LOG_VAR
(
ll
)
<<
" CPU: "
<<
_cpu
;
LOG_VAR
(
ll
)
<<
" Metric: "
<<
_metric
;
}
protected:
unsigned
int
_cpu
;
uint64_t
_metric
;
...
...
src/sensors/msr/MSRSensorGroup.cpp
View file @
9d77eae5
...
...
@@ -184,3 +184,14 @@ void MSRSensorGroup::program_fixed(){
void
MSRSensorGroup
::
addCpu
(
unsigned
int
cpu
){
cpuToFd
[
cpu
]
=
-
1
;
/* -1 because no file descriptor has been assigned yet. */
}
void
MSRSensorGroup
::
printConfig
(
LOG_LEVEL
ll
)
{
std
::
stringstream
ss
;
const
char
*
separator
=
""
;
for
(
auto
&
kv
:
cpuToFd
)
{
ss
<<
separator
<<
kv
.
first
;
separator
=
", "
;
}
LOG_VAR
(
ll
)
<<
" CPUs: "
<<
ss
.
str
();
}
src/sensors/msr/MSRSensorGroup.h
View file @
9d77eae5
...
...
@@ -28,6 +28,8 @@ public:
void
addCpu
(
unsigned
int
cpu
);
//void init(boost::asio::io_service& io) override;
void
printConfig
(
LOG_LEVEL
ll
)
override
;
private:
void
read
()
override
;
void
readAsync
()
override
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment