Lines Matching full:thermometer
65 struct thermometer { struct
258 struct thermometer *thermometer) in thermometer_add_tz() argument
272 tz = realloc(thermometer->tz, sizeof(*thermometer->tz) * (thermometer->nr_tz + 1)); in thermometer_add_tz()
274 ERROR("Failed to allocate thermometer->tz\n"); in thermometer_add_tz()
278 thermometer->tz = tz; in thermometer_add_tz()
279 thermometer->tz[thermometer->nr_tz].fd_temp = fd; in thermometer_add_tz()
280 thermometer->tz[thermometer->nr_tz].name = strdup(name); in thermometer_add_tz()
281 thermometer->tz[thermometer->nr_tz].polling = polling; in thermometer_add_tz()
282 thermometer->nr_tz++; in thermometer_add_tz()
290 struct thermometer *thermometer) in thermometer_init() argument
333 tz_regex->polling, thermometer)) in thermometer_init()
356 static int thermometer_start(struct thermometer *thermometer, in thermometer_start() argument
364 INFO("Capturing %d thermal zone(s) temperature...\n", thermometer->nr_tz); in thermometer_start()
371 for (i = 0; i < thermometer->nr_tz; i++) { in thermometer_start()
374 thermometer->tz[i].name, options->postfix); in thermometer_start()
387 fprintf(f, "timestamp(ms) %s(°mC)\n", thermometer->tz[i].name); in thermometer_start()
389 thermometer->tz[i].file_out = f; in thermometer_start()
391 DEBUG("Created '%s' file for thermal zone '%s'\n", path, thermometer->tz[i].name); in thermometer_start()
396 thermometer->tz[i].fd_timer = timerfd_create(CLOCK_MONOTONIC, 0); in thermometer_start()
397 if (thermometer->tz[i].fd_timer < 0) { in thermometer_start()
399 thermometer->tz[i].name); in thermometer_start()
404 thermometer->tz[i].name, thermometer->tz[i].polling); in thermometer_start()
407 msec_to_timespec(thermometer->tz[i].polling); in thermometer_start()
409 if (timerfd_settime(thermometer->tz[i].fd_timer, 0, in thermometer_start()
413 if (mainloop_add(thermometer->tz[i].fd_timer, in thermometer_start()
415 &thermometer->tz[i])) in thermometer_start()
521 static int thermometer_stop(struct thermometer *thermometer) in thermometer_stop() argument
527 for (i = 0; i < thermometer->nr_tz; i++) in thermometer_stop()
528 fclose(thermometer->tz[i].file_out); in thermometer_stop()
541 struct thermometer thermometer = { 0 }; in main() local
557 if (thermometer_init(&config, &thermometer)) in main()
560 if (thermometer_start(&thermometer, &options)) in main()
569 if (thermometer_stop(&thermometer)) in main()