/*1* Copyright © 2020 Collabora, Ltd.2* Author: Antonio Caggiano <[email protected]>3*4* SPDX-License-Identifier: MIT5*/67#pragma once89#include <perfetto.h>1011#define PPS_LOG PERFETTO_LOG12#define PPS_LOG_IMPORTANT PERFETTO_ILOG13#define PPS_LOG_ERROR PERFETTO_ELOG14#define PPS_LOG_FATAL PERFETTO_FATAL1516namespace pps17{18enum class State {19Stop, // initial state, or stopped by the tracing service20Start, // running, sampling data21};2223/// @brief Checks whether a return value is valid24/// @param res Result from a syscall25/// @param msg Message to prepend to strerror26/// @return True if ok, false otherwise27bool check(int res, const char *msg);2829/// @param num Numerator30/// @param den Denominator31/// @return A ratio between two floating point numbers, or 0 if the denominator is 032constexpr double ratio(double num, double den)33{34return den > 0.0 ? num / den : 0.0;35}3637} // namespace pps383940