Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tracecompass-dev] Use Trace compass internal storage for large trace streaming mode
  • From: Bernd Hufmann <bernd.hufmann@xxxxxxxxxxxx>
  • Date: Thu, 29 Aug 2024 14:22:21 +0000
  • Accept-language: en-CA, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ericsson.com; dmarc=pass action=none header.from=ericsson.com; dkim=pass header.d=ericsson.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zZDoCc5qWByy0VMKVWWo7+igSlrlDzDAPm6ZFTpOKyw=; b=BOh7rKIBbQa+IoqDrq/NrETYkNFPudfsqFcZ07z6zSoX5t4OhIxWFQN2G+h5Odt7w8Uty+xE9P+H6hmT5+t9gKN0g6a2RDkgt2iPGabizy1JWQ62XP9zVIxY+gYNbqoQxx8brZ6KuumIAb6an5eYxpKMn9k1k8UX1EwdBXQ5Jyz1auKphsQRzNyPpiWXExLGCaXQSGPw0SS4FNxawD6m72jG2jlw4FN6XRquudQIMVhHauUz2WPaHV7txM9eoxbCsBWcWysf27dUILz39s9GmxGvYRFd17dSt8s7qvkaC8+xBS6xjLPwgX4eaNohbXgdbp8c6wWj7drXwzl1V6W94Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UvchoVU/sA3Bz/HnnnrP78RmAldwn9o01LsYGlEm15Dt3VWpkp0TBBjllR0xfGQFkI47XyW7l7GbwnUZHMKRPvgS3KS6HjWT8tuac/4xpSCmWV41WSAW7QLaZkRZRKcAUP2TyGAtuvR4Nk26K+K8bj601fBNhtPu0RSdT5a/mwmk7TrJpfG7V0PE5+NnTyaMhZ7a6hYmDplhveP+/CWiCuOD2d01V5crg6nBhJqA45OC3KKtyiwrKYWbXozmIJOYX81l8S1b65cDoz9KY8e+vjxJUNeThwpmCL1F2SMJFj8BY3nIX8ATq0Y+QTLID/ulbQMdmoCV/IUvj8q63ZCogg==
  • Delivered-to: tracecompass-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/tracecompass-dev/>
  • List-help: <mailto:tracecompass-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/tracecompass-dev>, <mailto:tracecompass-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/tracecompass-dev>, <mailto:tracecompass-dev-request@eclipse.org?subject=unsubscribe>
  • Msip_labels:
  • Thread-index: AQHa5vaot+DFjNivWEK23V0KmjFcbrInHI49gAWx/QCAAzgLAIAAM55HgAriTwCAAqS9gIAAp1Mq
  • Thread-topic: Use Trace compass internal storage for large trace streaming mode

Hi,

analysis modules can be automatic or non-automatic (see extension point). Automatic modules are scheduled when the trace opens, non-automatic are scheduled when corresponding view is opened. Hence TmfStatisticsEventTypesModule is running because it's an automatic one. 

The Eclipse job of an analysis module is running until the analysis module is completed (or cancelled). For TmfStateSystemAnalysisModules for example, the job exits when the ITmfEventRequest is finished, which reads the trace from a start time to end time. A new ITmfEventRequest should be re-triggered for each traceRangeUpdated(), that resumes reading the trace until the new end time and update the state system. 

Reading the code I realized that for streaming the interface ITmfTraceCompleteness needs to implemented. TmfTrace class implements it the default implementation is for non-streaming traces, i.e. isComplete() returns true. There are different places where this interface is called and it's purpose is to handle stream traces and process newly received events. Please try to override the corresponding methods of that interface in your trace type.

I don't have an example to verify that this actually still works. Our main use case is to post-mortem analyse traces that are not streamed.

Please let me know how it goes.

Regards,
Bernd




From: Vinod Appu <vinod.appu@xxxxxxxxxxx>
Sent: August 28, 2024 11:57 PM
To: Bernd Hufmann <bernd.hufmann@xxxxxxxxxxxx>; tracecompass-dev@xxxxxxxxxxx <tracecompass-dev@xxxxxxxxxxx>
Cc: Matthew Khouzam <matthew.khouzam@xxxxxxxxxxxx>
Subject: RE: Use Trace compass internal storage for large trace streaming mode
 

Hi team,

 

Any insights?

 

In between, Is it possible to stop analysis and continue again on a latter point of time? Use case I don’t want to see any job progress once my trace streaming is paused.

 

~Vinod

 

From: Vinod Appu
Sent: Tuesday, August 27, 2024 5:06 PM
To: Bernd Hufmann <bernd.hufmann@xxxxxxxxxxxx>; tracecompass-dev@xxxxxxxxxxx
Subject: RE: Use Trace compass internal storage for large trace streaming mode

 

Hi,

 

Mine is not an experiment.

The moment I put a BP in TmfStateSystemAnalysisModule#traceRangeUpdated(), I got the data in the view. Seems like a timing issue. Any input on this?

 

I’ve tried to create a state system and keeping the function flow in it and then tried to use the same for view. Since I’m filling state system from some other thread, I thought to just inject it via my custom state provider and skip the analysis part. But once I tried it, I’ve seen that the other analysis modules (Eg: TmfStatisticsEventTypesModule) looking for events. Ie: my CustomTrace extends TmfTrace to return event in ITmfEvent getNext(ITmfContext context) and long getNbEvents() to be handled but I don’t see an option to recreate it from the state system I’ve generated. Is my approach possible?

 

 

~Vinod

 

From: Bernd Hufmann <bernd.hufmann@xxxxxxxxxxxx>
Sent: Tuesday, August 20, 2024 7:04 PM
To: Vinod Appu <vinod.appu@xxxxxxxxxxx>; Matthew Khouzam <matthew.khouzam@xxxxxxxxxxxx>; tracecompass-dev@xxxxxxxxxxx
Subject: Re: Use Trace compass internal storage for large trace streaming mode

 

Hi,

 

Not sure what is going on and why it's not working. The signal TmfTraceRangeUpdatedSignal is the right one to notify the analysis modules that new trace data is available. It is supposed to create a request to read the trace from the provide start and end time. In streaming mode, this signal is sent repeatedly, every time new trace data is available which you have some kind of logic implemented. In non-streaming mode, this signal is only sent once when the trace (or experiment) instance handles the TmfTraceOpenedSignal.

 

To figure out what is going on, I would suggest to debug and have a breakpoint when the TmfTraceRangeUpdatedSignal is sent and received. Analysis modules of type TmfStateSystemAnalysisModule handle that signal in method traceRangeUpdated() (see here https://github.com/eclipse-tracecompass/org.eclipse.tracecompass/blob/5704617daf69f3e5951b38180cec21340ba7b99b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/statesystem/TmfStateSystemAnalysisModule.java#L820)

 

Maybe also check if the TmfTraceOpenedSignal was handled (TmfTrace or TmfExperiment in case of an experiment)

 

BTW, The getStreamingInterval() method of TmfTrace / TmfExperiment determines if it's a streaming trace (value > 0) or a offline trace (value = 0). 

 

I hope this helps.

 

Regards

Bernd

 


From: Vinod Appu <vinod.appu@xxxxxxxxxxx>
Sent: August 20, 2024 6:18 AM
To: Bernd Hufmann <bernd.hufmann@xxxxxxxxxxxx>; Matthew Khouzam <matthew.khouzam@xxxxxxxxxxxx>; tracecompass-dev@xxxxxxxxxxx <tracecompass-dev@xxxxxxxxxxx>
Subject: RE: Use Trace compass internal storage for large trace streaming mode

 

Hi,

 

Any guidance or alternate approach suggestions?

 

~Vinod

 

From: Vinod Appu
Sent: Sunday, August 18, 2024 2:39 PM
To: Bernd Hufmann <bernd.hufmann@xxxxxxxxxxxx>; Matthew Khouzam <matthew.khouzam@xxxxxxxxxxxx>; tracecompass-dev@xxxxxxxxxxx
Subject: RE: Use Trace compass internal storage for large trace streaming mode

 

Hi,

 

We already have a function flow graph using trace compass working, where we do analysis only once. What I’m trying to do is adding streaming support, when analysis in progress, new data coming and it’s getting analysed and visualized. Obviously, new data can come or cannot.

Sorry to say that when you say “streaming is not supported out of the box & there is some code to achieve that”, It’s chaotic for me.

 

I’ve tried below, was expecting this to work. But I see no events coming for analysis, AbstractTMFStateProvider$EventProcessor#fEventsQueue has no data coming.

 

MyTrace extends TmfTrace{

               @Override

               public boolean isComplete() {

                              return false;

               }

 

               @Override

               public long getStreamingInterval() {

                              // TODO: What is the relevance of streaming interval?

                              return 300;

               }

// Update as events coming, now a timer thread doing this

               public void sendStreamingRangeUpdatedEvent() {

                              if (!isTraceOpened.getAndSet(true)) {

                                             fNbEvents = functionEvents.size();

                                             try {

                                                            seek(0);

                                                            final ITmfContext context = seekEvent(0);

                                                            getNext(context);

                                                            context.dispose();

                                             } catch (IOException e) {

                                                            Activator.log(e);

                                             }

                                             TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, this, null));

                              } else {

                                             final TmfTimeRange timeRange = new TmfTimeRange(getStartTime(),

                                                                           TmfTimestamp.fromNanos(System.currentTimeMillis() * 1000));

                                             final TmfTraceRangeUpdatedSignal rangeUpdatedsignal = new TmfTraceRangeUpdatedSignal(this, this, timeRange);

                                             broadcastAsync(rangeUpdatedsignal);

                              }

               }

}

 

Your guidance will allow us to use the framework effectively!

~Vinod

 

From: Bernd Hufmann <bernd.hufmann@xxxxxxxxxxxx>
Sent: Thursday, August 15, 2024 12:01 AM
To: Matthew Khouzam <matthew.khouzam@xxxxxxxxxxxx>; tracecompass-dev@xxxxxxxxxxx
Cc: Vinod Appu <vinod.appu@xxxxxxxxxxx>
Subject: Re: Use Trace compass internal storage for large trace streaming mode

 

Hi,

 

First of all, what do you mean with streaming function flow trace? Do you mean that you have stream trace data into a trace that Trace Compass is then supposed to analyze and when new trace data arrives continue with the analysis (live trace analysis)? Please clarify. 

 

Streaming and  live trace analysis is not fully supported at the moment. There is some code to achieve that and views are made to allow to display data while the trace (offline trace) is analysed. But handling streamed trace is not supported out of the box.

 

If you store data in heap you run into issue of running out of heap, depending on trace size and size of heap. That's why in Trace Compass intermediate storages on disk like state system  exists.

 

I think you can use the state system to store the data and then have data providers (another Trace Compass concept) to query the state system and further analyse or visualize the data.

 

Since you dealing with function entries/exits you might want to look into the flame chart analysis (or also called call stack analysis) and how it uses the state system apis to store that. In particular, it use the pushAttribute and popAttribute feature of the state system.

 

Here is the state provider for the call stack analysis of LTTng UST traces with function entry/exit  (from finstrument functions of gcc). It extends a generic CallStackStateProvider

  

Once you have created your own state provider extending the CallStackStateProvider then you can create an analysis module extending https://github.com/eclipse-tracecompass/org.eclipse.tracecompass/blob/master/analysis/org.eclipse.tracecompass.analysis.profiling.core/src/org/eclipse/tracecompass/analysis/profiling/core/instrumented/InstrumentedCallStackAnalysis.java. After adding the analysis module to your plugin.xml then you should be able to see the a call stack view out-of-the-box in Trace Compass

 

I hope this helps. If you have any more questions please let us know

 

Regards

Bernd

 


From: tracecompass-dev <tracecompass-dev-bounces@xxxxxxxxxxx> on behalf of Vinod Appu via tracecompass-dev <tracecompass-dev@xxxxxxxxxxx>
Sent: August 5, 2024 1:16 AM
To: Matthew Khouzam <matthew.khouzam@xxxxxxxxxxxx>; tracecompass-dev@xxxxxxxxxxx <tracecompass-dev@xxxxxxxxxxx>
Cc: Vinod Appu <vinod.appu@xxxxxxxxxxx>
Subject: [tracecompass-dev] Use Trace compass internal storage for large trace streaming mode

 

Hi,

 

I’m trying to implement a streaming function flow trace (function entry and exit), where the below specific case is getting handled.

 

  1. Now we keep function entry and exit it in a list in heap which is the data to be displayed, but obviously for large data, this is not enough.
  2. If we store the function entry and exit again into a file, which will affect the performance.

 

Below is what I’m trying to achieve in theory.

 

  1. Use state system itself as the cache, stream events and feed to the state system.
  2. Let the state system persist data to hard disk in its own format.
  3. One-time sequential analysis, I’ll discard the original data once analysis is done (Need to identify a point where this can be done too.)

 

Please share your thoughts, Could you please share the major areas I must investigate?

 

~Vinod


Back to the top