On Mon, 25 Feb 2019 15:37:57 +0000 Tzvetomir Stoyanov <tstoyanov@xxxxxxxxxx> wrote: > Hi Steven, > When tracing host and guest machines, in order to overcome the drift > between the times in both contexts, we need to use multiple (at least > 2) time offsets. In addition, we need the local time stamp, related to > each offset: > (ts_offset1, ts_local1), (ts_offset2, ts_local2), .... > where ts_local1 is the time when the offset ts_offset1 was measured. > This information should be stored somehow in trace.dat file, which > currently supports only one TRACECMD_OPTION_OFFSET option. > There are two possible approaches to do it, please suggest which one to choose: > > 1. Use the existing TRACECMD_OPTION_OFFSET, written 2 times in the > trace.dat file. Extract the ts_local1 and ts_local2 times from the > file, as ts_local1 is the time of the first event and ts_local2 is the > time of the last event. There are few cons of this approach: > - we can use only 2 offsets, before and after the trace. > - mapping ts_local1 and ts_local2 to the times of the first > and last event is not accurate, as these are not the actual times when > the time stamps were calculated. > - Finding first and last event from the trace.dat file will > require one extra parsing of the whole file, as the events there are > not sorted. > > 2. Introduce a new TRACECMD_OPTION_ option, which will hold all > ts_offsets together with ts_local times. > Option 2 is the right approach. The offset is just for the --date operation by itself. This should be something new, and for older trace-cmd reading this file, it can simply ignore it. What about: TRACECMD_OPTION_TIME_SHIFT does that sound good? I'm open for other suggestions. -- Steve