Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
dcdb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
dcdb
dcdb
Commits
966d4401
Commit
966d4401
authored
Feb 28, 2019
by
lu43jih
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing msr bugs
parent
a6818d68
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
86 deletions
+21
-86
src/sensors/msr/MSRConfigurator.cpp
src/sensors/msr/MSRConfigurator.cpp
+9
-2
src/sensors/msr/MSRSensorBase.h
src/sensors/msr/MSRSensorBase.h
+3
-3
src/sensors/msr/MSRSensorGroup.cpp
src/sensors/msr/MSRSensorGroup.cpp
+8
-5
src/sensors/msr/MSRSensorGroup.h
src/sensors/msr/MSRSensorGroup.h
+1
-1
src/sensors/msr/appendToMakefile.txt
src/sensors/msr/appendToMakefile.txt
+0
-8
src/sensors/msr/msr.conf
src/sensors/msr/msr.conf
+0
-40
src/sensors/msr/msr2.conf
src/sensors/msr/msr2.conf
+0
-27
No files found.
src/sensors/msr/MSRConfigurator.cpp
View file @
966d4401
...
...
@@ -6,6 +6,7 @@
*/
#include "MSRConfigurator.h"
#include <iomanip>
MSRConfigurator
::
MSRConfigurator
()
{
_groupName
=
"group"
;
...
...
@@ -17,7 +18,9 @@ MSRConfigurator::~MSRConfigurator() {}
void
MSRConfigurator
::
sensorBase
(
MSRSensorBase
&
s
,
CFG_VAL
config
)
{
ADD
{
if
(
boost
::
iequals
(
val
.
first
,
"metric"
)){
s
.
setMetric
(
std
::
stoull
(
val
.
second
.
data
(),
nullptr
,
16
));
//TODO try catch...
uint64_t
metric
=
std
::
stoull
(
val
.
second
.
data
(),
nullptr
,
16
);
s
.
setMetric
(
metric
);
}
}
}
...
...
@@ -184,7 +187,11 @@ void MSRConfigurator::customizeAndStore(SG_Ptr g) {
}
else
{
for
(
auto
s
:
original
)
{
auto
s_otherCPUs
=
std
::
make_shared
<
MSRSensorBase
>
(
s
->
getName
());
s_otherCPUs
->
setName
(
s
->
getName
(),
cpu
);
std
::
size_t
found
=
s
->
getName
().
find_first_of
(
"."
);
if
(
found
!=
std
::
string
::
npos
){
found
++
;
//to skip the point
s_otherCPUs
->
setName
(
s
->
getName
().
substr
(
found
),
cpu
);
}
s_otherCPUs
->
setCpu
(
cpu
);
s_otherCPUs
->
setMetric
(
s
->
getMetric
());
auto
size
=
s
->
getMqtt
().
size
();
...
...
src/sensors/msr/MSRSensorBase.h
View file @
966d4401
...
...
@@ -42,9 +42,9 @@ public:
}
void
printConfig
(
LOG_LEVEL
ll
,
LOGGER
&
lg
)
{
LOG_VAR
(
ll
)
<<
" CPU: "
<<
_cpu
;
LOG_VAR
(
ll
)
<<
" Metric: "
<<
_metric
;
}
LOG_VAR
(
ll
)
<<
" CPU: "
<<
_cpu
;
LOG_VAR
(
ll
)
<<
" Metric: "
<<
_metric
;
}
protected:
unsigned
int
_cpu
;
...
...
src/sensors/msr/MSRSensorGroup.cpp
View file @
966d4401
...
...
@@ -42,8 +42,6 @@ void MSRSensorGroup::start() {
return
;
}
program_fixed
();
for
(
auto
&
kv
:
cpuToFd
)
{
int
cpu
=
kv
.
first
;
char
*
path
=
new
char
[
200
];
...
...
@@ -62,6 +60,8 @@ void MSRSensorGroup::start() {
cpuToFd
[
cpu
]
=
handle
;
}
program_fixed
();
_keepRunning
=
1
;
_pendingTasks
++
;
_timer
->
async_wait
(
std
::
bind
(
&
MSRSensorGroup
::
readAsync
,
this
));
...
...
@@ -85,11 +85,13 @@ void MSRSensorGroup::read() {
try
{
for
(
auto
s
:
_sensors
)
{
msr_read
(
s
->
getMetric
(),
&
reading
.
value
,
s
->
getCpu
());
s
->
storeReading
(
reading
);
auto
ret_val
=
msr_read
(
s
->
getMetric
(),
&
reading
.
value
,
s
->
getCpu
());
if
(
ret_val
!=
-
1
){
s
->
storeReading
(
reading
);
#ifdef DEBUG
LOG
(
debug
)
<<
_groupName
<<
"::"
<<
s
->
getName
()
<<
" raw reading:
\"
"
<<
reading
.
value
<<
"
\"
"
;
LOG
(
debug
)
<<
_groupName
<<
"::"
<<
s
->
getName
()
<<
" raw reading:
\"
"
<<
reading
.
value
<<
"
\"
"
;
#endif
}
}
}
catch
(
const
std
::
exception
&
e
)
{
LOG
(
error
)
<<
"Sensorgroup"
<<
_groupName
<<
" could not read value: "
<<
e
.
what
();
...
...
@@ -136,6 +138,7 @@ void MSRSensorGroup::program_fixed(){
&&
ctrl_reg
.
fields
.
usr1
&&
ctrl_reg
.
fields
.
os2
&&
ctrl_reg
.
fields
.
usr2
)
{
//yes! Free running counters were set by someone else => we don't need to program them, just read them.
LOG
(
debug
)
<<
"CPU"
<<
kv
.
first
<<
" has free running counter, so there will be no fixed counter programming"
;
continue
;
}
//not all of them (or none) are enabled => we program them again
...
...
src/sensors/msr/MSRSensorGroup.h
View file @
966d4401
...
...
@@ -37,7 +37,7 @@ private:
void
program_fixed
();
std
::
map
<
unsigned
int
,
int
>
cpuToFd
;
int32_t
msr_read
(
uint64_t
msr_number
,
uint64_t
*
value
,
unsigned
int
cpu
);
int32_t
msr_read
(
uint64_t
msr_number
,
uint64_t
*
value
,
unsigned
int
cpu
);
int32_t
msr_write
(
uint64_t
msr_number
,
uint64_t
value
,
unsigned
int
cpu
);
};
...
...
src/sensors/msr/appendToMakefile.txt
deleted
100644 → 0
View file @
a6818d68
Append to PLUGINS variable: msr
Append at end of Makefile:
libdcdbplugin_msr.$(LIBEXT): src/sensors/msr/MSRSensorGroup.o src/sensors/msr/MSRConfigurator.o
$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system
NOTE: Probably you will have to append further libraries to the linker for your plugin to compile
src/sensors/msr/msr.conf
deleted
100644 → 0
View file @
a6818d68
;
comments
in
config
files
are
indicated
by
a
semicolon
global
{
mqttPrefix
/
FF112233445566778899AABB
;
add
here
other
global
attributes
for
your
plugin
}
template_group
def1
{
;
define
template
groups
by
appending
"template_"
interval
1000
minValues
3
groupAtt
1234
;
add
other
attributes
your
plugin
requires
for
a
sensor
group
;
define
sensors
belonging
to
the
group
below
sensor
temp1
{
sensorAtt
5678
;
add
other
attributes
your
plugin
requires
for
a
sensor
}
}
single_sensor
sens1
{
;
if
you
want
a
group
with
only
one
sensor
you
can
use
a
single_sensor
default
temp1
mqttsuffix
0001
;
add
other
attributes
your
plugin
requires
for
a
sensor
}
group
g1
{
interval
1000
mqttprefix
01
default
def1
;
sensor
temp1
is
taken
from
def1
and
does
not
need
to
be
redefined
sensor
gSens
{
mqttsuffix
00
}
}
src/sensors/msr/msr2.conf
deleted
100644 → 0
View file @
a6818d68
global
{
mqttPrefix
/
FF112233445566778899AABBFFFF
;
add
here
other
global
attributes
for
your
plugin
}
group
g1
{
interval
1000
mqttprefix
01
cpus
0
-
95
sensor
Instructions
{
mqttsuffix
00
metric
0
x309
}
sensor
Cycles
{
mqttsuffix
01
metric
0
x30A
}
sensor
RefCycles
{
mqttsuffix
02
metric
0
x30B
}
}
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