- sscanf(line, "call %u %li %li %li %li %li %u %s", &call.no, &call.gpuStart, &call.gpuDuration, &call.cpuStart, &call.cpuDuration, &call.pixels, &call.program, name);
- call.name = name;
- profile->frames.back().calls.push_back(call);
- } else if (strncmp(line, "frame_begin ", 12) == 0) {
+
+ line >> call.no
+ >> call.gpuStart
+ >> call.gpuDuration
+ >> call.cpuStart
+ >> call.cpuDuration
+ >> call.pixels
+ >> call.program
+ >> call.name;
+
+ if (lastGpuTime < call.gpuStart + call.gpuDuration) {
+ lastGpuTime = call.gpuStart + call.gpuDuration;
+ }
+
+ if (lastCpuTime < call.cpuStart + call.cpuDuration) {
+ lastCpuTime = call.cpuStart + call.cpuDuration;
+ }
+
+ profile->calls.push_back(call);
+
+ if (call.pixels >= 0) {
+ if (profile->programs.size() <= call.program) {
+ profile->programs.resize(call.program + 1);
+ }
+
+ Profile::Program& program = profile->programs[call.program];
+ program.cpuTotal += call.cpuDuration;
+ program.gpuTotal += call.gpuDuration;
+ program.pixelTotal += call.pixels;
+ program.calls.push_back(profile->calls.size() - 1);
+ }
+ } else if (type.compare("frame_end") == 0) {