uint32_t count;
};
+event ThreadStartApiEvent
+{
+};
+
+event ThreadStartWorkerEvent
+{
+};
+
event DrawInstancedEvent
{
uint32_t drawId;
pContext->ppScratch = new uint8_t*[pContext->NumWorkerThreads];
pContext->pStats = new SWR_STATS[pContext->NumWorkerThreads];
-#if KNOB_ENABLE_AR
+#if defined(KNOB_ENABLE_AR)
// Setup ArchRast thread contexts which includes +1 for API thread.
pContext->pArContext = new HANDLE[pContext->NumWorkerThreads+1];
pContext->pArContext[pContext->NumWorkerThreads] = ArchRast::CreateThreadContext();
+ _AR_EVENT(pContext->pArContext[pContext->NumWorkerThreads], ThreadStartApiEvent());
#endif
// Allocate scratch space for workers.
pContext->ppScratch[i] = (uint8_t*)AlignedMalloc(32 * sizeof(KILOBYTE), KNOB_SIMD_WIDTH * 4);
#endif
-#if KNOB_ENABLE_AR
+#if defined(KNOB_ENABLE_AR)
// Initialize worker thread context for ArchRast.
pContext->pArContext[i] = ArchRast::CreateThreadContext();
+ _AR_EVENT(pContext->pArContext[i], ThreadStartWorkerEvent());
#endif
}
AlignedFree(pContext->ppScratch[i]);
#endif
-#if KNOB_ENABLE_AR
+#if defined(KNOB_ENABLE_AR)
ArchRast::DestroyThreadContext(pContext->pArContext[i]);
#endif
}
field_types = []
end_of_event = False
+ num_fields = 0
+
# record all fields in event definition.
# note: we don't check if there's a leading brace.
while not end_of_event and idx < len(lines):
if field:
field_types.append(field.group(2))
field_names.append(field.group(4))
+ num_fields += 1
end_of_event = re.match(r"(\s*)};", line)
event_dict['field_types'] = field_types
event_dict['field_names'] = field_names
+ event_dict['num_fields'] = num_fields
+
return idx
def parse_enums(lines, idx, event_dict):
${field_types[i]} ${field_names[i]},
% endif
% if i == len(field_names)-1:
- ${field_types[i]} ${field_names[i]})
+ ${field_types[i]} ${field_names[i]}
% endif
% endfor
+ )
{
% for i in range(len(field_names)):
data.${field_names[i]} = ${field_names[i]};
% for name in protos['event_names']:
virtual void handle(${name}& event)
{
+% if protos['events'][name]['num_fields'] == 0:
+ write(${protos['events'][name]['event_id']}, (char*)&event.data, 0);
+% else:
write(${protos['events'][name]['event_id']}, (char*)&event.data, sizeof(event.data));
+%endif
}
% endfor