MCPcopy Create free account
hub / github.com/PlatformLab/NanoLog / record

Method record

runtime/TimeTrace.cc:125–147  ·  view source on GitHub ↗

* Record an event in the buffer. * * \param timestamp * Identifies the time at which the event occurred. * \param format * A format string for snprintf that will be used, along with * arg0..arg3, to generate a human-readable message describing what * happened, when the time trace is printed. The message is generated * by calling snprintf as follows: * snprint

Source from the content-addressed store, hash-verified

123 * Argument to use when printing a message about this event.
124 */
125void TimeTrace::Buffer::record(uint64_t timestamp, const char* format,
126 uint32_t arg0, uint32_t arg1, uint32_t arg2, uint32_t arg3)
127{
128 if (activeReaders > 0) {
129 return;
130 }
131
132 Event* event = &events[nextIndex];
133 nextIndex = (nextIndex + 1) & BUFFER_MASK;
134
135 // There used to be code here for prefetching the next few events,
136 // in order to minimize cache misses on the array of events. However,
137 // performance measurements indicate that this actually slows things
138 // down by 2ns per invocation.
139 // prefetch(event+1, NUM_PREFETCH*sizeof(Event));
140
141 event->timestamp = timestamp;
142 event->format = format;
143 event->arg0 = arg0;
144 event->arg1 = arg1;
145 event->arg2 = arg2;
146 event->arg3 = arg3;
147}
148
149/**
150 * Return a string containing a printout of the records in the buffer.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected