//===-- PerfHelper.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 // //===----------------------------------------------------------------------===// /// /// \file /// Helpers for measuring perf events. /// //===----------------------------------------------------------------------===// #ifndef LLVM_TOOLS_LLVM_EXEGESIS_PERFHELPER_H #define LLVM_TOOLS_LLVM_EXEGESIS_PERFHELPER_H #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/Config/config.h" #include "llvm/Support/Error.h" #include <cstdint> #include <functional> #include <memory> #ifdef _MSC_VER typedef int pid_t; #else #include <sys/types.h> #endif // _MSC_VER struct perf_event_attr; namespace llvm { namespace exegesis { namespace pfm { // Returns true on error. bool pfmInitialize(); void pfmTerminate(); // Retrieves the encoding for the event described by pfm_event_string. // NOTE: pfm_initialize() must be called before creating PerfEvent objects. class PerfEvent { … }; // Represents a single event that has been configured in the Linux perf // subsystem. class ConfiguredEvent { … }; // Consists of a counter measuring a specific event and associated validation // counters measuring execution conditions. All counters in a group are part // of a single event group and are thus scheduled on and off the CPU as a single // unit. class CounterGroup { … }; } // namespace pfm } // namespace exegesis } // namespace llvm #endif // LLVM_TOOLS_LLVM_EXEGESIS_PERFHELPER_H