Skip to content

Commit 3c4d346

Browse files
committed
Extend from-target timestamping to 1/10us resolution
1 parent 9614d42 commit 3c4d346

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Version 2.3.0 In progress
2+
* Extend from-target timestamping to 1/10th microsecond resolution with rounding
23
* Add support for ITM rollover counters in orbtop (if they deliver information, they will be displayed)
34
* Add STM32 CORTEX-M33 support (Tested on STM32U5A5)
45
* Add communications pacing to orbtop for direct file reads

Src/orbcat.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
#define ABS_FORMAT C_TSTAMP "%s.%03" PRIu64"|" C_RESET
4747
#define STAMP_FORMAT C_TSTAMP "%12" PRIu64 "|" C_RESET
4848
#define STAMP_FORMAT_MS C_TSTAMP "%8" PRIu64 ".%03" PRIu64 "_%03" PRIu64 "|" C_RESET
49-
#define STAMP_FORMAT_MS_DELTA C_TSTAMP "%5" PRIu64 ".%03" PRIu64 "_%03" PRIu64 "|" C_RESET
49+
//#define STAMP_FORMAT_MS_DELTA C_TSTAMP "%5" PRIu64 ".%03" PRIu64 "_%03" PRIu64 "|" C_RESET
50+
#define STAMP_FORMAT_MS_DELTA C_TSTAMP "%5" PRIu64 ".%03" PRIu64 "_%03" PRIu64 "_%01" PRIu64 "|" C_RESET
5051

5152
enum TSType { TSNone, TSAbsolute, TSRelative, TSDelta, TSStamp, TSStampDelta, TSNumTypes };
5253

@@ -217,8 +218,9 @@ static void _printTimestamp( char *strstore )
217218

218219
if ( options.cps )
219220
{
220-
uint64_t tms = ( delta * 1000000 ) / options.cps;
221-
sprintf( strstore, STAMP_FORMAT_MS_DELTA, tms / 1000000, ( tms / 1000 ) % 1000, tms % 1000 );
221+
/* Provide some rounding .. we're at the limits of what's sensible here */
222+
uint64_t tms = ( delta * 10000000 + options.cps / 2 ) / options.cps;
223+
sprintf( strstore, STAMP_FORMAT_MS_DELTA, tms / 10000000, ( tms / 10000 ) % 10000, ( tms / 10 ) % 1000, tms % 10 );
222224
}
223225
else
224226
{

0 commit comments

Comments
 (0)