Introduction
Introduction Statistics Contact Development Disclaimer Help
Fail if no sensors found. - energy - measure system energy usage
Log
Files
Refs
Tags
README
LICENSE
---
commit 33cf70dcdbb4ed08ba53d121d06a3c6904db9af7
parent b7668ab38ae59f6202ea72674b738ec0b676e227
Author: Troels Henriksen <[email protected]>
Date: Wed, 23 Aug 2023 12:25:44 +0200
Fail if no sensors found.
Diffstat:
M energy.c | 5 +++++
1 file changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/energy.c b/energy.c
@@ -143,6 +143,11 @@ int main(int argc, char** argv) {
sensor_rapl();
sensor_battery();
+ if (num_sensors == 0) {
+ fprintf(stderr, "%s: no sensors found; not running command.\n", argv[0]);
+ exit(1);
+ }
+
for (int i = 0; i < num_sensors; i++) {
sensors[i].start(sensors[i].data);
}
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.