Skip to content

Commit 92cee15

Browse files
authored
fix: remove power_data, power_model csv file usage (#532)
1 parent 366de99 commit 92cee15

File tree

5 files changed

+8
-40
lines changed

5 files changed

+8
-40
lines changed

build/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,5 @@ COPY --from=builder /opt/app-root/src/github.com/sustainable-computing-io/kepler
3333

3434
RUN mkdir -p /var/lib/kepler/data
3535
COPY --from=builder /opt/app-root/src/github.com/sustainable-computing-io/kepler/data/normalized_cpu_arch.csv /var/lib/kepler/data/normalized_cpu_arch.csv
36-
COPY --from=builder /opt/app-root/src/github.com/sustainable-computing-io/kepler/data/power_data.csv /var/lib/kepler/data/power_data.csv
37-
COPY --from=builder /opt/app-root/src/github.com/sustainable-computing-io/kepler/data/power_model.csv /var/lib/kepler/data/power_model.csv
3836

3937
ENTRYPOINT ["/usr/bin/kepler"]

data/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
# CPU Model
22
[cpu_model.csv](./cpu_model.csv) relates CPU model family found in `/proc/cpuinfo` to its architecture.
3-
4-
# Power Data
5-
[power_data.csv](./power_data.csv) is retrieved from [Cloud Carbon Footprint](https://github.com/cloud-carbon-footprint/cloud-carbon-coefficients), as an estimate of energy consumption per CPU thread and GB DRAM.

doc/dev/prepare_dev_env.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,4 @@ DATAPATH="/var/lib/kepler/data/"
66
mkdir -p ${DATAPATH}
77

88
cp ../data/normalized_cpu_arch.csv ${DATAPATH}
9-
cp ../data/power_data.csv ${DATAPATH}
10-
cp ../data/power_model.csv ${DATAPATH}
119

pkg/bpfassets/perf_event_bindata.go

Lines changed: 7 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/power/components/source/estimate.go

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,19 @@ limitations under the License.
1717
package source
1818

1919
import (
20-
"encoding/csv"
2120
"fmt"
22-
"io"
2321
"os"
2422
"regexp"
2523
"runtime"
2624
"strconv"
2725
"strings"
2826
"time"
29-
30-
"github.com/jszwec/csvutil"
3127
)
3228

3329
type PowerEstimate struct{}
3430

3531
var (
36-
powerDataPath = "/var/lib/kepler/data/power_data.csv" // obtained from https://github.com/cloud-carbon-footprint/cloud-carbon-coefficients/blob/main/output/coefficients-aws-use.csv
37-
dramRegex = "^MemTotal:[\\s]+([0-9]+)"
32+
dramRegex = "^MemTotal:[\\s]+([0-9]+)"
3833

3934
dramInGB int
4035
cpuCores = runtime.NumCPU()
@@ -66,28 +61,6 @@ func getDram() (int, error) {
6661
return 0, fmt.Errorf("no memory info found")
6762
}
6863

69-
func getCPUPowerEstimate(cpu string) (perThreadMinPowerEstimate, perThreadMaxPowerEstimate, perGBPowerEstimate float64, err error) {
70-
file, _ := os.Open(powerDataPath)
71-
reader := csv.NewReader(file)
72-
73-
dec, err := csvutil.NewDecoder(reader)
74-
if err != nil {
75-
return 0.0, 0.0, 0.0, err
76-
}
77-
78-
for {
79-
var p PowerEstimateData
80-
if err := dec.Decode(&p); err == io.EOF {
81-
break
82-
}
83-
if p.Architecture == cpu {
84-
return p.MinWatts, p.MaxWatts, p.PerGBWatts, nil
85-
}
86-
}
87-
88-
return 0.0, 0.0, 0.0, fmt.Errorf("no CPU power info found")
89-
}
90-
9164
// If the Estimated Power is being used, it means that the system does not support Components Power Measurement
9265
func (r *PowerEstimate) IsSystemCollectionSupported() bool {
9366
return false

0 commit comments

Comments
 (0)