#ifndef BENCHMARK_TRACK_H
#define BENCHMARK_TRACK_H
#include <config.h>
#include <arch/benchmark.h>
#include <benchmark/benchmark_track_types.h>
#include <arch/api/constants.h>
#include <machine/io.h>
#include <kernel/cspace.h>
#include <model/statedata.h>
#include <mode/machine.h>
#if defined(DEBUG) || defined(CONFIG_BENCHMARK_TRACK_KERNEL_ENTRIES)
#define TRACK_KERNEL_ENTRIES 1
extern kernel_entry_t ksKernelEntry;
#ifdef CONFIG_BENCHMARK_TRACK_KERNEL_ENTRIES
#define MAX_LOG_SIZE (seL4_LogBufferSize / \
sizeof(benchmark_track_kernel_entry_t))
extern timestamp_t ksEnter;
extern seL4_Word ksLogIndex;
extern seL4_Word ksLogIndexFinalized;
void benchmark_track_exit(void);
static inline void
benchmark_track_start(void)
{
ksEnter = timestamp();
}
#endif
static inline void
benchmark_debug_syscall_start(word_t cptr, word_t msgInfo, word_t syscall)
{
seL4_MessageInfo_t info = messageInfoFromWord_raw(msgInfo);
lookupCapAndSlot_ret_t lu_ret = lookupCapAndSlot(NODE_STATE(ksCurThread), cptr);
ksKernelEntry.path = Entry_Syscall;
ksKernelEntry.syscall_no = -syscall;
ksKernelEntry.cap_type = cap_get_capType(lu_ret.cap);
ksKernelEntry.invocation_tag = seL4_MessageInfo_get_label(info);
}
#endif
#endif