Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tracecompass.incubator-dev] Plotting a Simple XY Chart

Hi Basavaraj,


The view you obtain is correct for the script you run. You seem to have taken as is the statisticsDensityXY.js script [1] example which takes the Statistics module which just counts the event types. If you want your own data to be displayed in the view, you need to create your own state system with the data in it. Look at the basicAnalysis.js example [2] instead. It shows how to create your own analysis from your trace's data.


I was curious to see if it all worked with custom parsers, so I tried with your trace. At the end of this email is a script that works with your trace. You can fine-tune it to your need.


[1] https://github.com/tahini/tracecompass-ease-scripting/blob/master/examples/_javascript_/statisticsDensityXY.js

[2] https://github.com/tahini/tracecompass-ease-scripting/blob/master/examples/_javascript_/basicAnalysis.js


Cheers,

Geneviève


-----------

loadModule('/TraceCompass/Analysis');
loadModule('/TraceCompass/DataProvider');
loadModule('/TraceCompass/View');

// Create an analysis named activetid.js.
var analysis = getAnalysis("myanalysis.js");

if (analysis == null) {
    print("Trace is null");
    exit();
}

// Get the analysis's state system so we can fill it, false indicates to create a new state system even if one already exists, true would re-use an existing state system
var ss = analysis.getStateSystem(false);

// The analysis itself is in this function
function runAnalysis() {
    // Get the event iterator for the trace
    var iter = analysis.getEventIterator();
   
    var event = null;
    // Parse all events
    while (iter.hasNext()) {
       
        event = iter.next();
       
        if (event.getName().startsWith("Line")) {
            load = getFieldValue(event, "load");
            if ((load != null)) {
                quark = ss.getQuarkAbsoluteAndAdd("load");
                ss.modifyAttribute(event.getTimestamp().toNanos(), parseInt(load, 10), quark);
            }
        }
       
    }
    // Done parsing the events, close the state system at the time of the last event, it needs to be done manually otherwise the state system will still be waiting for values and will not be considered finished building
    if (event != null) {
        ss.closeHistory(event.getTimestamp().toNanos());
    }
}

// This condition verifies if the state system is completed. For instance, if it had been built in a previous run of the script, it wouldn't run again.
if (!ss.waitUntilBuilt(0)) {
    // State system not built, run the analysis
    runAnalysis();
}

var map = new java.util.HashMap();
map.put(ENTRY_PATH, '*');
map.put(ENTRY_DELTA, false);
provider = createXYProvider(analysis, map);
if (provider != null) {
    openXYChartView(provider);
}


On 11/18/19 2:47 AM, Basavaraj Munnoli wrote:
Hi  Geneviève,

I have attached the script (Script.txt) and trace (Sample Trace.txt) files and also a screenshot of the XY chart (trace_XY_chart.PNG) that I am getting. As you can see in the screenshot, the Y axis is taking the quark values. How can I make it take the cpu_load values instead? (The third column in the trace file represents the cpu loads.) 

I have also attached the custom parser that I have used (sample_trace_custom_parser.xml).

Thanks,
Basavaraj


On Sat, 16 Nov 2019 at 01:52, Geneviève Bastien <gbastien+lttng@xxxxxxxxxxxx> wrote:

Hi Basavaraj,


It's hard to answer your question without seeing what you did, maybe you could share a screenshot or the script? In any case, make sure the content of the state system that you are trying to display is OK.

Which examples have you used? How did you get to know about EASE? Have you seen this tutorial lab about writing EASE analyses: https://github.com/tuxology/tracevizlab/tree/master/labs/204-scripted-analysis-for-custom-instrumentation

Look at task 6, that shows how to view what's inside your state system before building a data provider. The next task creates a time graph data provider, which could as well be an XY data provider.


HTH,

Geneviève


On 11/15/19 2:22 AM, Basavaraj Munnoli wrote:
Hello community,

I have a simple trace that has some event types along with their cpu loads (in percentages) and timestamps. I want to plot a simple line graph (timpestamp vs cpu load in %) for each event type. I have followed the example scripts and by using createXYProvider(analysis, map) and openXYChartView(provider) functions I have been able to get a line graph for each event type, with time stamp on the X axis. However, the Y axis displays quark values. I am not getting how to make my Y axis use the cpu load values instead of quark values. Need support in this regard.

P.S.: I am using _javascript_ in EASE framework.

Thanks,
Basavaraj Munnoli



_______________________________________________
tracecompass.incubator-dev mailing list
tracecompass.incubator-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/tracecompass.incubator-dev
_______________________________________________
tracecompass.incubator-dev mailing list
tracecompass.incubator-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/tracecompass.incubator-dev

_______________________________________________
tracecompass.incubator-dev mailing list
tracecompass.incubator-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/tracecompass.incubator-dev

Back to the top