better perf

This commit is contained in:
Martino Ferrari
2026-02-25 16:51:07 +01:00
parent aaf69c0949
commit dfb399bbba
12 changed files with 713 additions and 633 deletions

View File

@@ -4,6 +4,7 @@
#include "StandardParser.h"
#include "StreamString.h"
#include "BasicUDPSocket.h"
#include "HighResolutionTimer.h"
#include <assert.h>
#include <stdio.h>
@@ -41,7 +42,8 @@ void TestFullTracePipeline() {
printf("Simulating cycles...\n");
for (int i=0; i<50; i++) {
mockValue = 1000 + i;
service.ProcessSignal(sig, sizeof(uint32));
uint64 ts = (uint64)((float64)HighResolutionTimer::Counter() * HighResolutionTimer::Period() * 1000000.0);
service.ProcessSignal(sig, sizeof(uint32), ts);
Sleep::MSec(10);
}
@@ -62,13 +64,14 @@ void TestFullTracePipeline() {
printf("Header: Magic=0x%X, Count=%u, Seq=%u\n", h->magic, h->count, h->seq);
uint32 offset = sizeof(TraceHeader);
if (size >= offset + 8) {
if (size >= offset + 16) {
uint32 recId = *(uint32*)(&buffer[offset]);
uint32 recSize = *(uint32*)(&buffer[offset + 4]);
printf("Data: ID=%u, Size=%u\n", recId, recSize);
if (size >= offset + 8 + recSize) {
uint64 recTs = *(uint64*)(&buffer[offset + 4]);
uint32 recSize = *(uint32*)(&buffer[offset + 12]);
printf("Data: ID=%u, TS=%lu, Size=%u\n", recId, recTs, recSize);
if (size >= offset + 16 + recSize) {
if (recSize == 4) {
uint32 recVal = *(uint32*)(&buffer[offset + 8]);
uint32 recVal = *(uint32*)(&buffer[offset + 16]);
printf("Value=%u\n", recVal);
}
}

View File

@@ -8,6 +8,7 @@
#include "RealTimeApplication.h"
#include "GlobalObjectsDatabase.h"
#include "RealTimeLoader.h"
#include "HighResolutionTimer.h"
#include <assert.h>
#include <stdio.h>
@@ -133,10 +134,15 @@ void RunValidationTest() {
uint32 offset = sizeof(TraceHeader);
for (uint32 i=0; i<h->count; i++) {
uint32 sigId = *(uint32*)(&buffer[offset]);
uint32 val = *(uint32*)(&buffer[offset + 8]);
if (offset + 16 > size) break;
if (sigId == 0) {
uint32 sigId = *(uint32*)(&buffer[offset]);
uint32 sigSize = *(uint32*)(&buffer[offset + 12]);
if (offset + 16 + sigSize > size) break;
if (sigId == 0 && sigSize == 4) {
uint32 val = *(uint32*)(&buffer[offset + 16]);
if (!first) {
if (val != lastCounter + 1) {
discontinuities++;
@@ -146,8 +152,7 @@ void RunValidationTest() {
totalSamples++;
}
uint32 sigSize = *(uint32*)(&buffer[offset + 4]);
offset += (8 + sigSize);
offset += (16 + sigSize);
}
first = false;
}