Lines Matching refs:thermometer
65 struct thermometer { struct
258 struct thermometer *thermometer) in thermometer_add_tz() argument
271 thermometer->tz = realloc(thermometer->tz, in thermometer_add_tz()
272 sizeof(*thermometer->tz) * (thermometer->nr_tz + 1)); in thermometer_add_tz()
273 if (!thermometer->tz) { in thermometer_add_tz()
278 thermometer->tz[thermometer->nr_tz].fd_temp = fd; in thermometer_add_tz()
279 thermometer->tz[thermometer->nr_tz].name = strdup(name); in thermometer_add_tz()
280 thermometer->tz[thermometer->nr_tz].polling = polling; in thermometer_add_tz()
281 thermometer->nr_tz++; in thermometer_add_tz()
289 struct thermometer *thermometer) in thermometer_init() argument
332 tz_regex->polling, thermometer)) in thermometer_init()
355 static int thermometer_start(struct thermometer *thermometer, in thermometer_start() argument
363 INFO("Capturing %d thermal zone(s) temperature...\n", thermometer->nr_tz); in thermometer_start()
370 for (i = 0; i < thermometer->nr_tz; i++) { in thermometer_start()
373 thermometer->tz[i].name, options->postfix); in thermometer_start()
386 fprintf(f, "timestamp(ms) %s(°mC)\n", thermometer->tz[i].name); in thermometer_start()
388 thermometer->tz[i].file_out = f; in thermometer_start()
390 DEBUG("Created '%s' file for thermal zone '%s'\n", path, thermometer->tz[i].name); in thermometer_start()
395 thermometer->tz[i].fd_timer = timerfd_create(CLOCK_MONOTONIC, 0); in thermometer_start()
396 if (thermometer->tz[i].fd_timer < 0) { in thermometer_start()
398 thermometer->tz[i].name); in thermometer_start()
403 thermometer->tz[i].name, thermometer->tz[i].polling); in thermometer_start()
406 msec_to_timespec(thermometer->tz[i].polling); in thermometer_start()
408 if (timerfd_settime(thermometer->tz[i].fd_timer, 0, in thermometer_start()
412 if (mainloop_add(thermometer->tz[i].fd_timer, in thermometer_start()
414 &thermometer->tz[i])) in thermometer_start()
520 static int thermometer_stop(struct thermometer *thermometer) in thermometer_stop() argument
526 for (i = 0; i < thermometer->nr_tz; i++) in thermometer_stop()
527 fclose(thermometer->tz[i].file_out); in thermometer_stop()
540 struct thermometer thermometer = { 0 }; in main() local
556 if (thermometer_init(&config, &thermometer)) in main()
559 if (thermometer_start(&thermometer, &options)) in main()
568 if (thermometer_stop(&thermometer)) in main()