From b847e69abbbe16b7dc8f75e19925dc27f0a3d0bf Mon Sep 17 00:00:00 2001 From: Tahsincan Köse Date: Tue, 30 Nov 2021 20:28:41 +0300 Subject: Provide stimuli output capability. --- src/zenmonitor-cli.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') 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; -- cgit v1.2.3-70-g09d2