hawktracer icon indicating copy to clipboard operation
hawktracer copied to clipboard

ID for Timeline

Open ftanuma opened this issue 6 years ago • 5 comments

Hi,

It would be great if I can use multiple timelines from the same thread, and distinguish when the data is converted to .httrace and see it on Chrome tracing tool.

It looks that event->thread_id is used to map a timeline to a tid in httrace, but for this use case, we probably need ID for timeline itself and use it for tid.

Thanks!

ftanuma avatar Sep 24 '19 22:09 ftanuma

Hi @ftanuma Adding identifier for a timeline would require some architectural changes which I'd like to avoid 0.x major version. I might consider that change for HawkTracer v1.x (not sure though), but for now, we could provide a feature for merging streams in the converter with labels, so each of your timeline (within one thread) could have different listeners and stream tracepoints e.g. to different files, so you can then merge them into single httrace file. Would this solution be enough for now? I know this is sounds like workaround, but I'd like to quickly satisfy your requirements before we implement the feature properly (I'm not sure yet whether the solution would be to add timeline id to event, or something different)

loganek avatar Nov 09 '19 18:11 loganek

Hi @loganek,

Yes. merging multiple trace files offline is a reasonable option :) Thank you for considering!

ftanuma avatar Nov 13 '19 04:11 ftanuma

Hi @loganek,

I have been trying to find the option to merge multiple trace files offline by using the converter. Is that feature already available? Thanks in advance

nullpointerderef avatar Mar 20 '20 08:03 nullpointerderef

@osvillalon sorry for late reply. Unfortunately the feature is not available yet. I'll try to work on that over the upcoming weekend.

loganek avatar Mar 23 '20 22:03 loganek

@osvillalon @ftanuma sorry it took me soo long to look into that. I've prototyped a first version of merging multiple streams into one in the loganek/multi-stream-client branch. The basic usage is:

./client/hawktracer-converter --source multi_dump_1.htdump,multi_dump_2.htdump  --output out.json  --source-id dump1,dump2 --source-offset -1200,1500

As you can see, there are 3 changes:

  • source parameter takes a coma-separated list of streams (in this case, 2 files: multi_dump_1.htdump and multi_dump_2.htdump, but it could also be two or more TCP streams, or one TCP stream and one file stream etc.)
  • source-id parameter has been added - this is just a list of labels for your streams. It's optional, and by default will generate names like source_1, source_2 etc.
  • source-offset parameter has been added - this is needed in case you merge streams from distributed systems, and want to synchronize timestamps. If you run two streams within the same process, you can set it to zero (or not specify this parameter at all, since it's 0 by default).

The feature has been implemented using processes. See picture below: multi-streams

For now I only tested it with file streams, and I'm sure there'll be some problems with TCP, but wanted to get back to you with some prototype so I can get feedback from you about user interface. The code also requires a lot of refactoring.

As I said, any feedback is very welcome, as I'm still experimenting with this feature. Many thanks!

loganek avatar May 10 '20 20:05 loganek