Lines Matching defs:thermometer

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