timer_utils.h 680 B

12345678910111213141516171819202122232425262728
  1. /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
  2. * Use of this source code is governed by a BSD-style license that can be
  3. * found in the LICENSE file.
  4. */
  5. #ifndef VBOOT_REFERENCE_TIMER_UTILS_H_
  6. #define VBOOT_REFERENCE_TIMER_UTILS_H_
  7. #include <inttypes.h>
  8. #include <time.h>
  9. typedef struct ClockTimer {
  10. struct timespec start_time;
  11. struct timespec end_time;
  12. } ClockTimerState;
  13. /* Start timer and update [ct]. */
  14. void StartTimer(ClockTimerState* ct);
  15. /* Stop timer and update [ct]. */
  16. void StopTimer(ClockTimerState* ct);
  17. /* Get duration in milliseconds. */
  18. uint32_t GetDurationMsecs(ClockTimerState* ct);
  19. #endif /* VBOOT_REFERENCE_TIMER_UTILS_H_ */