|
|
|
|
|
by Thaxll
657 days ago
|
|
> hat's what the vdso version of clock_gettime does. If you use one of the *_COARSE clocks it will only update periodically and be much faster, but that means like 15 milliseconds of log messages will all have the same timestamp. Not sure it matters a lot of to have multiple messages with the same timestamp, since they were added in order you still know which one is older, the problem might arise when you send those logs to a remote place and the order of insert is discarded and the timestamp is used instead. I assume that when you use a single thread with a queue / ring buffer the order of insertion is kept. |
|
If you have an event loop, it might be acceptable to sample the counter once per iteration, but less than that it becomes too lossy.