Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Trace Compass » Help non-Linux/non-Java embedded C developer make use of Trace Compass
Help non-Linux/non-Java embedded C developer make use of Trace Compass [message #1794462] Thu, 30 August 2018 21:27 Go to next message
Buck Fobb is currently offline Buck FobbFriend
Messages: 2
Registered: August 2018
Junior Member
Hi all

I'm developing C on bare metal ARM Cortex (M3) with a very basic custom OS (no Linux) and am attempting to make use of Trace Compass to trace thread states (very very basic threading), specific finite state machines in the code, call stacks (well, instrumented call enter/exit sequence - not full stack - for short sections of executing code to look for optimizations), etc. TC seems like it could be a great boon to us bare metal developers, if I could figure it out. I'm not a Linux or Java developer, so I'm trying to figure out how to bend TC to my will.

I'm successfully putting basic trace info (event timestamp + test events like ThreadRun, ThreadStop, etc.) into CTF and getting Eclipse to import it. I can see the list/table of events and event contents. However the trace views (call graph analysis, critical path, etc.) don't populate like hope. I'm guessing this is because these are tailored for Linux/LTTng and I'm not presenting info in a format it understands. I've also tried to implement custom xml per the "Data driven analysis" http://archive.eclipse.org/tracecompass/doc/stable/org.eclipse.tracecompass.doc.user/Data-driven-analysis.html#Data_driven_analysis in the Trace Compass User's Guide using xml but not having a ton of success. Not knowing what's going on inside Trace Compass it is difficult to know what the elements and attributes do.

Are there any tutorials geared toward me: bare metal embedded guy (non-Linux/Java) who wants to make use of Trace Compass?

Thanks for any help.
Re: Help non-Linux/non-Java embedded C developer make use of Trace Compass [message #1794506 is a reply to message #1794462] Fri, 31 August 2018 15:04 Go to previous messageGo to next message
Matthew Khouzam is currently offline Matthew KhouzamFriend
Messages: 11
Registered: March 2011
Junior Member

Hey, welcome on board.

A couple of things:

1- Our response time in the mailing list is a bit better typically (https://www.eclipse.org/tracecompass/#community). It is much better on IRC.

2- We worked a lot on getting things working well in the kernel. For a simpler trace, maybe making it mimic BTF or trace event in JSON could speed up your dev cycle.

In BTF you have a text file described here: https://wiki.eclipse.org/images/e/e6/TA_BTF_Specification_2.1.3_Eclipse_Auto_IWG.pdf

Trace event in JSON is described here: https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#

Let's talk about the example views you picked:
Critical path depends on a kernel trace at the moment. You can fake it since you have threads.
Call Graph needs a flame chart. A flame chart shows entry/exits, not threads. but it is sorted by threads.

If you want a call graph to be filled, you need to have entry events, exit events and Thread ID (TID) discriminators.


I can see a control flow view being easily populated. As well as a resources view.

They both need "IRQ entry exits" Sched switch (thread start and stop with a core and TID will work).

If you share your trace, we can help more!

Cheers!
Matthew.
Re: Help non-Linux/non-Java embedded C developer make use of Trace Compass [message #1816892 is a reply to message #1794462] Mon, 11 November 2019 09:21 Go to previous messageGo to next message
Vyacheslav Verkhovin is currently offline Vyacheslav VerkhovinFriend
Messages: 2
Registered: November 2019
Junior Member
Buck Fobb wrote on Thu, 30 August 2018 21:27
I'm developing C on bare metal ARM Cortex (M3) with a very basic custom OS (no Linux)
...
I'm successfully putting basic trace info (event timestamp + test events like ThreadRun, ThreadStop, etc.) into CTF and getting Eclipse to import it. I can see the list/table of events and event contents. However the trace views (call graph analysis, critical path, etc.) don't populate like hope.
...
Are there any tutorials geared toward me: bare metal embedded guy (non-Linux/Java) who wants to make use of Trace Compass?


I has similar question. I use simple RTOS, and I try add tracing in core (using barectf). I has CTF binary file and metadata file, I can import it in TraceCompass and i can view all event:
Timestamp		Channel		Event type		Contents	

07:00:00.000 080 000	channel0_0	isr_enter					
07:00:00.000 080 000	channel0_0	thread_ready		thread_id=3927689344				
07:00:00.000 080 000	channel0_0	thread_ready		thread_id=3927689152				
07:00:00.000 080 000	channel0_0	thread_ready		thread_id=3927688960				
07:00:00.000 080 000	channel0_0	isr_exit					
07:00:00.000 080 000	channel0_0	thread_switched_out	thread_id=3927690624				
07:00:00.000 080 000	channel0_0	thread_switched_in	thread_id=3927689344				
07:00:00.000 080 000	channel0_0	thread_switched_out	thread_id=3927689344				
07:00:00.000 080 000	channel0_0	thread_switched_in	thread_id=3927689152				
07:00:00.000 080 000	channel0_0	thread_switched_out	thread_id=3927689152	

What I should do to see Flow Control grapf (similar to)? What has changed over the year? Is it enough for me to write the correct metadata file? Or I need write additional XML/XSD file? Buck FobbFriend, can you tell us what you did and your success?

Matthew Khouzam, BTF look interested, but it is ASCII text format, and slowly (as compared with CTF). Can I convert my binary CTF files in BTF format?
Re: Help non-Linux/non-Java embedded C developer make use of Trace Compass [message #1817111 is a reply to message #1816892] Fri, 15 November 2019 15:09 Go to previous messageGo to next message
Matthew Khouzam is currently offline Matthew KhouzamFriend
Messages: 11
Registered: March 2011
Junior Member

Hi Vyacheslav,

In order to populate a time graph with a custom CTF file, you need to make a custom data driven analysis file.

The example given here https://archive.eclipse.org/tracecompass/doc/stable/org.eclipse.tracecompass.doc.user/Data-driven-analysis.html#Defining_an_XML_state_provider
is very similar to your requirement.

If you want to convert CTF to BTF, I would suggest looking at babeltrace. But in that case, also maybe modify your CTF file a bit to make it more btf like.

Another option would be to change the events to match the Linux kernel events, then everything would work out of the box. In DefaultEventLayout:


isr_entry -> irq_handler_entry
isr_exit -> irq_handler_exit
thread_switched_out -> sched_switch
thread_switched_in -> sched_switch
etc...

Hope that can help.

Matthew
Re: Help non-Linux/non-Java embedded C developer make use of Trace Compass [message #1817184 is a reply to message #1817111] Mon, 18 November 2019 08:43 Go to previous messageGo to next message
Vyacheslav Verkhovin is currently offline Vyacheslav VerkhovinFriend
Messages: 2
Registered: November 2019
Junior Member
Dear Matthew, thanks.
1) I will try write custom data driven analysis file.
2) I will also try to rewrite my code, for compatibility with Linux kernel events. Where can I find list Linux event and them description (irq_handler_entry,irq_handler_exit,sched_switch and etc), those that are compatible with TraceCompass out of the box?
Re: Help non-Linux/non-Java embedded C developer make use of Trace Compass [message #1817195 is a reply to message #1817184] Mon, 18 November 2019 12:32 Go to previous message
Matthew Khouzam is currently offline Matthew KhouzamFriend
Messages: 11
Registered: March 2011
Junior Member

2- Alas, it's in the code base. But I will drop it here:



/*******************************************************************************
* Copyright (c) 2015 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Alexandre Montplaisir - Initial API and implementation
******************************************************************************/

package org.eclipse.tracecompass.analysis.os.linux.core.trace;

import java.util.Collection;

import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;

import com.google.common.collect.ImmutableList;

/**
* A kernel event layout to be used by default. This can be useful for
* data-driven traces for example, where they can provide whatever event names
* they want.
*
* Due to historical reasons, the definitions are the same as LTTng event names.
*
* @author Alexandre Montplaisir
* @since 1.0
*/
public class DefaultEventLayout implements IKernelAnalysisEventLayout {

private static @Nullable DefaultEventLayout INSTANCE;

/**
* The instance of this event layout
*
* This object is completely immutable, so no need to create additional
* instances via the constructor.
*
* @return the instance
* @since 2.0
*/
public static synchronized DefaultEventLayout getInstance() {
DefaultEventLayout inst = INSTANCE;
if (inst == null) {
inst = new DefaultEventLayout();
INSTANCE = inst;
}
return inst;
}

/* Event names */
private static final String IRQ_HANDLER_ENTRY = "irq_handler_entry"; //$NON-NLS-1$
private static final String IRQ_HANDLER_EXIT = "irq_handler_exit"; //$NON-NLS-1$
private static final String SOFTIRQ_ENTRY = "softirq_entry"; //$NON-NLS-1$
private static final String SOFTIRQ_EXIT = "softirq_exit"; //$NON-NLS-1$
private static final String SOFTIRQ_RAISE = "softirq_raise"; //$NON-NLS-1$
private static final String HRTIMER_START = "hrtimer_start"; //$NON-NLS-1$
private static final String HRTIMER_CANCEL = "hrtimer_cancel"; //$NON-NLS-1$
private static final String HRTIMER_EXPIRE_ENTRY = "hrtimer_expire_entry"; //$NON-NLS-1$
private static final String HRTIMER_EXPIRE_EXIT = "hrtimer_expire_exit"; //$NON-NLS-1$
private static final String SCHED_SWITCH = "sched_switch"; //$NON-NLS-1$
private static final String SCHED_PI_SETPRIO = "sched_pi_setprio"; //$NON-NLS-1$

private static final String SCHED_TTWU = "sched_ttwu"; //$NON-NLS-1$
private static final String SCHED_WAKING = "sched_waking"; //$NON-NLS-1$
private static final String SCHED_WAKEUP = "sched_wakeup"; //$NON-NLS-1$
private static final String SCHED_WAKEUP_NEW = "sched_wakeup_new"; //$NON-NLS-1$
private static final Collection<String> SCHED_WAKEUP_EVENTS = ImmutableList.of(SCHED_WAKEUP, SCHED_WAKEUP_NEW);

private static final String SCHED_PROCESS_FORK = "sched_process_fork"; //$NON-NLS-1$
private static final String SCHED_PROCESS_EXIT = "sched_process_exit"; //$NON-NLS-1$
private static final String SCHED_PROCESS_FREE = "sched_process_free"; //$NON-NLS-1$
private static final String SCHED_PROCESS_EXEC = "sched_process_exec"; //$NON-NLS-1$
private static final String STATEDUMP_PROCESS_STATE = "lttng_statedump_process_state"; //$NON-NLS-1$

private static final String SYSCALL_ENTRY_PREFIX = "sys_"; //$NON-NLS-1$
private static final String COMPAT_SYSCALL_ENTRY_PREFIX = "compat_sys_"; //$NON-NLS-1$
private static final String SYSCALL_EXIT_PREFIX = "exit_syscall"; //$NON-NLS-1$

/* Field names */
private static final String IRQ = "irq"; //$NON-NLS-1$
private static final String TID = "tid"; //$NON-NLS-1$
private static final String VEC = "vec"; //$NON-NLS-1$
private static final String PREV_TID = "prev_tid"; //$NON-NLS-1$
private static final String PREV_STATE = "prev_state"; //$NON-NLS-1$
private static final String NEXT_COMM = "next_comm"; //$NON-NLS-1$
private static final String NEXT_TID = "next_tid"; //$NON-NLS-1$
private static final String PARENT_TID = "parent_tid"; //$NON-NLS-1$
private static final String CHILD_COMM = "child_comm"; //$NON-NLS-1$
private static final String CHILD_TID = "child_tid"; //$NON-NLS-1$
private static final String CHILD_PID = "child_pid"; //$NON-NLS-1$
private static final String PRIO = "prio"; //$NON-NLS-1$
private static final String NEW_PRIO = "newprio"; //$NON-NLS-1$
private static final String PREV_PRIO = "prev_prio"; //$NON-NLS-1$
private static final String NEXT_PRIO = "next_prio"; //$NON-NLS-1$
private static final String COMM = "comm"; //$NON-NLS-1$
private static final String NAME = "name"; //$NON-NLS-1$
private static final String STATUS = "status"; //$NON-NLS-1$
private static final String PREV_COMM = "prev_comm"; //$NON-NLS-1$
private static final String FILENAME = "filename"; //$NON-NLS-1$
private static final String HRTIMER = "hrtimer"; //$NON-NLS-1$
private static final String FUNCTION = "function"; //$NON-NLS-1$
private static final String EXPIRES = "expires"; //$NON-NLS-1$
private static final String NOW = "now"; //$NON-NLS-1$
private static final String SOFT_EXPIRES = "softexpires"; //$NON-NLS-1$
private static final String KMEM_ALLOC = "kmem_mm_page_alloc"; //$NON-NLS-1$
private static final String KMEM_FREE = "kmem_mm_page_free"; //$NON-NLS-1$
private static final String ORDER = "order"; //$NON-NLS-1$

/**
* Constructor, to be used by classes extending this one. To get an instance
* of this class, INSTANCE should be used.
*
* @since 2.0
*/
protected DefaultEventLayout() {
}

// ------------------------------------------------------------------------
// Event names
// ------------------------------------------------------------------------

@Override
public String eventIrqHandlerEntry() {
return IRQ_HANDLER_ENTRY;
}

@Override
public String eventIrqHandlerExit() {
return IRQ_HANDLER_EXIT;
}

@Override
public String eventSoftIrqEntry() {
return SOFTIRQ_ENTRY;
}

@Override
public String eventSoftIrqExit() {
return SOFTIRQ_EXIT;
}

@Override
public String eventSoftIrqRaise() {
return SOFTIRQ_RAISE;
}

@Override
public String eventSchedSwitch() {
return SCHED_SWITCH;
}

/**
* @since 1.0
*/
@Override
public String eventSchedPiSetprio() {
return SCHED_PI_SETPRIO;
}

@Override
public Collection<String> eventsSchedWakeup() {
return SCHED_WAKEUP_EVENTS;
}

@Override
public String eventSchedProcessFork() {
return SCHED_PROCESS_FORK;
}

@Override
public String eventSchedProcessExit() {
return SCHED_PROCESS_EXIT;
}

@Override
public String eventSchedProcessFree() {
return SCHED_PROCESS_FREE;
}

@Override
public @NonNull String eventStatedumpProcessState() {
return STATEDUMP_PROCESS_STATE;
}

@Override
public String eventSyscallEntryPrefix() {
return SYSCALL_ENTRY_PREFIX;
}

@Override
public String eventCompatSyscallEntryPrefix() {
return COMPAT_SYSCALL_ENTRY_PREFIX;
}

@Override
public String eventSyscallExitPrefix() {
return SYSCALL_EXIT_PREFIX;
}

/** @since 2.0 */
@Override
public String eventCompatSyscallExitPrefix() {
return SYSCALL_EXIT_PREFIX;
}

/**
* @since 2.0
*/
@Override
public String eventKmemPageAlloc() {
return KMEM_ALLOC;
}

/**
* @since 2.0
*/
@Override
public String eventKmemPageFree() {
return KMEM_FREE;

}

// ------------------------------------------------------------------------
// Event field names
// ------------------------------------------------------------------------

@Override
public String fieldIrq() {
return IRQ;
}

@Override
public String fieldVec() {
return VEC;
}

@Override
public String fieldTid() {
return TID;
}

@Override
public String fieldPrevTid() {
return PREV_TID;
}

@Override
public String fieldPrevState() {
return PREV_STATE;
}

@Override
public String fieldNextComm() {
return NEXT_COMM;
}

@Override
public String fieldNextTid() {
return NEXT_TID;
}

@Override
public String fieldChildComm() {
return CHILD_COMM;
}

@Override
public String fieldParentTid() {
return PARENT_TID;
}

@Override
public String fieldChildTid() {
return CHILD_TID;
}

@Override
public String fieldChildPid() {
return CHILD_PID;
}

/** @since 1.0 */
@Override
public String fieldPrio() {
return PRIO;
}

/** @since 1.0 */
@Override
public String fieldNewPrio() {
return NEW_PRIO;
}

/**
* @since 2.0
*/
@Override
public String fieldPrevPrio() {
return PREV_PRIO;
}

/** @since 1.0 */
@Override
public String fieldNextPrio() {
return NEXT_PRIO;
}

/** @since 2.0 */
@Override
public String fieldComm() {
return COMM;
}

/** @since 2.0 */
@Override
public String fieldName() {
return NAME;
}

/** @since 2.0 */
@Override
public String fieldStatus() {
return STATUS;
}

/** @since 2.0 */
@Override
public String fieldPrevComm() {
return PREV_COMM;
}

/** @since 2.0 */
@Override
public String fieldFilename() {
return FILENAME;
}

/** @since 2.0 */
@Override
public String eventSchedProcessExec() {
return SCHED_PROCESS_EXEC;
}

/** @since 2.0 */
@Override
public String eventSchedProcessWakeup() {
return SCHED_WAKEUP;
}

/** @since 2.0 */
@Override
public String eventSchedProcessWakeupNew() {
return SCHED_WAKEUP_NEW;
}

/** @since 2.0 */
@Override
public String eventHRTimerStart() {
return HRTIMER_START;
}

/** @since 2.0 */
@Override
public String eventHRTimerCancel() {
return HRTIMER_CANCEL;
}

/** @since 2.0 */
@Override
public String eventHRTimerExpireEntry() {
return HRTIMER_EXPIRE_ENTRY;
}

/** @since 2.0 */
@Override
public String eventHRTimerExpireExit() {
return HRTIMER_EXPIRE_EXIT;
}

/**
* Event indicating the source of the wakeup signal.
*
* @return The name of the event
* @since 2.0
*/
public String eventSchedProcessTTWU() {
return SCHED_TTWU;
}

/** @since 2.0 */
@Override
public String fieldHRtimer() {
return HRTIMER;
}

/** @since 2.0 */
@Override
public String fieldHRtimerFunction() {
return FUNCTION;
}

/** @since 2.0 */
@Override
public String fieldHRtimerExpires() {
return EXPIRES;
}

/** @since 2.0 */
@Override
public String fieldHRtimerSoftexpires() {
return SOFT_EXPIRES;
}

/** @since 2.0 */
@Override
public String fieldHRtimerNow() {
return NOW;
}

@Override
public String eventSchedProcessWaking() {
return SCHED_WAKING;
}

/**
* @since 2.2
*/
@Override
public @NonNull String fieldOrder() {
return ORDER;
}

}
Previous Topic:Runnables are not visible in BTF view
Next Topic:CPU usage view
Goto Forum:
  


Current Time: Sun Oct 25 02:48:43 GMT 2020

Powered by FUDForum. Page generated in 0.02224 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top