//===-- timing.h ------------------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef SCUDO_TIMING_H_ #define SCUDO_TIMING_H_ #include "common.h" #include "mutex.h" #include "string_utils.h" #include "thread_annotations.h" #ifndef __STDC_FORMAT_MACROS // Ensure PRId64 macro is available #define __STDC_FORMAT_MACROS … #endif #include <inttypes.h> #include <string.h> namespace scudo { class TimingManager; // A simple timer for evaluating execution time of code snippets. It can be used // along with TimingManager or standalone. class Timer { … }; // A RAII-style wrapper for easy scope execution measurement. Note that in order // not to take additional space for the message like `Name`. It only works with // TimingManager. class ScopedTimer : public Timer { … }; // In Scudo, the execution time of single run of code snippets may not be // useful, we are more interested in the average time from several runs. // TimingManager lets the registered timer report their data and reports the // average execution time for each timer periodically. class TimingManager { … }; } // namespace scudo #endif // SCUDO_TIMING_H_