mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-08 17:48:46 -10:00
The new design is centered around the Event Trace JSON format but it should still be possible to adapt it for other profiling tools. The old profiling system has been removed.
35 lines
644 B
C++
35 lines
644 B
C++
|
|
#include "MainFrameTimer.h"
|
|
|
|
namespace tracing {
|
|
|
|
MainFrameTimer::MainFrameTimer() : _out("profiling.csv") {
|
|
}
|
|
MainFrameTimer::~MainFrameTimer() {
|
|
_out.close();
|
|
}
|
|
void MainFrameTimer::processEvent(const trace_event* event) {
|
|
if (event->scope != &MainFrameScope || event->category != &MainFrame) {
|
|
return;
|
|
}
|
|
|
|
switch(event->type) {
|
|
case EventType::AsyncBegin:
|
|
_begin_time = event->timestamp;
|
|
break;
|
|
case EventType::AsyncEnd:
|
|
{
|
|
auto end = event->timestamp;
|
|
auto duration = event->timestamp - _begin_time;
|
|
|
|
_out << end << ";" << duration << "\n";
|
|
break;
|
|
}
|
|
default:
|
|
// Ignore everything else
|
|
return;
|
|
}
|
|
}
|
|
|
|
}
|