#ifndef PERF_HPP_
#define PERF_HPP_

#include <PerfHistory/PerfHistory.hpp>
#include <GraphicsContext/GraphicsContext.hpp>
#include <PixelMap/PixelMap.hpp>

#ifdef NO_PERF_TIMERS
#   define PERF_EVENT(history, event, code) code
#else
#   define PERF_EVENT(history, event, code) \
        PerfHistory::history.getTimeline(0).event.start(); \
        code \
        PerfHistory::history.getTimeline(0).event.end();
#endif

/**
 * @brief Draw a performance history graph.
 * 
 * @param context The graphics context.
 * @param history The history to draw.
 * @param x The X base.
 * @param y The Y base.
 * @param width The width allocated for the graph.
 * @param height The height allocated for the graph.
 * @param alpha The alpha channel to use.
 */
void drawPerfHistoryGraph(
    GraphicsContext &context,
    PerfHistory &history,
    int x, int y,
    int width, int height,
    float alpha = 1.0f
);

/**
 * @brief Make the performance timeline chart on a pixel map.
 */
PixelMap makePerfTimelineChart(PerfTimeline &timeline, PerfTimeline::Ticks threshold);

#endif