carb/profiler/IProfileMonitor.h

File members: carb/profiler/IProfileMonitor.h

// Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//

#pragma once

#include "../Defines.h"

#include "../Types.h"

namespace carb
{
namespace profiler
{

struct ProfileEvent
{
    const char* eventName;

    uint64_t threadId;

    uint64_t startTime;

    float timeInMs;

    uint16_t level;
};

using ProfileEvents = struct ProfileEventsImpl*;

struct IProfileMonitor
{
    CARB_PLUGIN_INTERFACE("carb::profiler::IProfileMonitor", 1, 1)

    ProfileEvents(CARB_ABI* getLastProfileEvents)();

    size_t(CARB_ABI* getLastProfileEventCount)(ProfileEvents events);

    ProfileEvent*(CARB_ABI* getLastProfileEventsData)(ProfileEvents events);

    uint32_t(CARB_ABI* getProfileThreadCount)(ProfileEvents events);

    uint64_t const*(CARB_ABI* getProfileThreadIds)(ProfileEvents events);

    void(CARB_ABI* releaseLastProfileEvents)(ProfileEvents events);

    uint64_t(CARB_ABI* getMainThreadId)(ProfileEvents events);

    void(CARB_ABI* markFrameEnd)();
};

} // namespace profiler
} // namespace carb