aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTahsincan Köse2021-11-30 20:28:41 +0300
committerTahsincan Köse2021-11-30 20:48:27 +0300
commitb847e69abbbe16b7dc8f75e19925dc27f0a3d0bf (patch)
treef4d482464ccb5ca9eba41c31c37e3a13545a204a
parented627fec85dc3f04d1d9e0bdfad3bc894ccfa878 (diff)
Provide stimuli output capability.
-rw-r--r--src/zenmonitor-cli.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/zenmonitor-cli.c b/src/zenmonitor-cli.c
index 7cf79f1..6792d02 100644
--- a/src/zenmonitor-cli.c
+++ b/src/zenmonitor-cli.c
@@ -14,6 +14,7 @@ gdouble delay = 0.5;
gchar *file = "";
SensorDataStore *store;
int quit = 0;
+int output_once = 0;
static GOptionEntry options[] = {
{"file", 'f', G_OPTION_FLAG_NONE, G_OPTION_ARG_STRING, &file,
@@ -22,6 +23,8 @@ static GOptionEntry options[] = {
"Interval of refreshing informations", "SECONDS"},
{"coreid", 'c', 0, G_OPTION_ARG_NONE, &display_coreid,
"Display core_id instead of core index", NULL},
+ {"output-once", 'o', 0, G_OPTION_ARG_NONE, &output_once,
+ "Output CPU information once and quit", NULL},
{NULL}};
static SensorSource sensor_sources[] = {
@@ -164,8 +167,12 @@ void update_data()
void start_watching()
{
while(!quit)
- {
+ {
update_data();
+ if (output_once)
+ {
+ break;
+ }
usleep(delay * 1000 * 1000);
}
}
@@ -190,7 +197,6 @@ int main(int argc, char *argv[])
init_sensors();
start_watching();
-
sensor_data_store_free(store);
return EXIT_SUCCESS;