Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [linuxtools-dev] TMF and pluggable state providers

Hi Michel,

> > Attached are some screen shots of this working now. One of them is for
> > a simple text log file and shows a hierarchy of DataCenter > Host > VM
> > and then state values are on the VM's only. (I work for VMware, so
> > that hierarchy seemed relevant). The text log uses the built in custom
> > txt trace. The other is actually a trace of Java function calls in an
> > application that were taken using another infrastructure that I
> > cobbled together using InTrace and UST.
> 
> The java calls don't show the nesting. When function 2 is called from
> function 1, no state is shown for function 1; if you want to gather
> statistics about self + childs, you probably want to have a state for
> "within a function but not at top level". In the VM case, several seem to be
> active at a time, presumably because the physical machine has several
> processors.

The model that I created has the ability to optionally track a stack of states for a given context.  So, there is the ability to "switch context" on a given event, but then there is also the ability to push or pop context on events as well.  The pushing and popping isn't used for the VM example that I sent, but for the java function tracing it is.  The java function tracer has only two types of events, function enty and function exit, and each of those have a thread id and the name of the function being entered or exited.  Given that, I needed to be able to "push" the context on the current thread on a function entry and pop the context on a function exit.  

Attached is the XML for the function tracer for reference.  It is not very clean yet honestly as I have yet to take time to do a proper implementation using UST, so the event names and such are somewhat poor.

The movement of the green values indicates which method/context is currently running for the current thread, and so there can only be one for a given thread.  In the example I sent the screenshot for, run calls function1, which calls function2, which calls function3.  Here is the code with irrelevant stuff snipped out:

	public void run() {
	int scratch = 0;
		try {
			scratch = function1(scratch);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}	
	private int function1(int value) throws InterruptedException {
		Thread.sleep(1);
		int returnValue = function2(value);
		Thread.sleep(1);
		return returnValue;	
	}	
	private int function2( int value ) throws InterruptedException {
		Thread.sleep(1);
		int returnValue = function3(value);
		Thread.sleep(1);
		return returnValue;		
	}	
	private int function3( int value ) throws InterruptedException {
		value = value + (int)(System.currentTimeMillis() % 10);
		Thread.sleep(10);
		return value;
	}

I think that I can see your point though, it would perhaps be useful to see explicitly which methods are upstack at a given moment. Next week I will try to create a different state/color for a function being "up stack" and see how that looks.

Aaron

Attachment: java-sequence.state-schema.xml
Description: XML document


Back to the top