#ifndef _TIMELINE_STRUCT_H_
#define _TIMELINE_STRUCT_H_

#include <cstddef>
#include <cstdint>
#include <cstring>
#include <stdint.h>
#include <string>
#include <list>
#include <map>

#pragma pack(push, 1)

typedef struct  {
  uint8_t type;
  uint16_t opCount;
  uint16_t funcIndex;
  size_t size;
  uint64_t timestamp;
  uint64_t gpuTimestamp;
} TimelineGpuEvent;

typedef struct {
  // int skip;
  // int skipped;
  uint64_t event_buffer_head;
  TimelineGpuEvent* event_buffer;
} TimelineGpuEventHandle;

typedef struct  {
  int skip;
  int skipped;
  uint16_t isFull;
  uint16_t curOpCount;
  uint16_t gpuMaxProfilingThreads;
  uint16_t gpuMaxProfilingEvents;
  TimelineGpuEventHandle* handle;
} TimelineGpuEventContext;

#pragma pack(pop)

typedef struct TimelineCpuEvent{
  uint16_t funcIndex;
  uint16_t opCount;
  const void* sendbuff;
  void* recvbuff;
  int root;
  size_t count;
  size_t nBytes;
  int nChannels;
  int nThreads;
  uint64_t beginTimestamp;
  uint64_t endTimestamp;
  char funcName[128];
} TimelineCpuEvent;

typedef struct  {
  std::map<uint16_t, TimelineCpuEvent*> * cpuCollEvent;
  std::map<uint16_t, TimelineCpuEvent*> * cpuP2pEvent;
} TimelineCpuEventContext;



#endif // _TIMELINE_STRUCT_H_
