forked from powerapi-ng/smartwatts-formula
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto_config.sh
executable file
·36 lines (34 loc) · 965 Bytes
/
auto_config.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
33
34
35
36
#!/usr/bin/env bash
maxfrequency=$(lscpu -b -p=MAXMHZ | tail -n -1| cut -d , -f 1)
minfrequency=$(lscpu -b -p=MINMHZ | tail -n -1 | cut -d , -f 1)
basefrequency=$(lscpu | grep "Model name" | cut -d @ -f 2 | cut -d G -f 1)
basefrequency=$(expr ${basefrequency}\*1000 | bc | cut -d . -f 1)
echo "
{
\"verbose\": true,
\"stream\": true,
\"input\": {
\"puller\": {
\"model\": \"HWPCReport\",
\"type\": \"socket\",
\"uri\": \"127.0.0.1\",
\"port\": 8080,
\"collection\": \"test_hwpc\"
}
},
\"output\": {
\"pusher_power\": {
\"type\": \"mongodb\",
\"uri\": \"mongodb://127.0.0.1\",
\"db\": \"test\",
\"collection\": \"prep\"
}
},
\"cpu-frequency-base\": $basefrequency,
\"cpu-frequency-min\": $minfrequency,
\"cpu-frequency-max\": $maxfrequency,
\"cpu-error-threshold\": 2.0,
\"disable-dram-formula\": true,
\"sensor-report-sampling-interval\": 1000
}
" > ./config_file.json