import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.AddContextDialogStub;
import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.CreateChannelDialogStub;
import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.CreateSessionDialogStub;
import org.eclipse.linuxtools.internal.lttng2.stubs.dialogs.DestroyConfirmDialogStub;
import org.osgi.framework.FrameworkUtil;
/**
- * The class <code>TraceControlKernelSessionTests</code> contains UST session/channel/event
+ * The class <code>TraceControlKernelSessionTests</code> contains Kernel session/channel/event
* handling test cases.
*/
assertEquals("0x2000", probeEvent.getOffset());
assertNull(null, probeEvent.getAddress());
assertEquals("create_dev", probeEvent.getSymbol());
+
+ // ------------------------------------------------------------------------
+ // Add Context on domain
+ // ------------------------------------------------------------------------
+ // Get Kernel domain component instance
+ domains = session.getChildren();
+ assertNotNull(domains);
+ assertEquals(1, domains.length);
+
+ AddContextDialogStub addContextStub = new AddContextDialogStub();
+ List<String> contexts = new ArrayList<String>();
+ contexts.add("prio");
+ contexts.add("perf:branch-misses");
+ contexts.add("perf:cache-misses");
+ addContextStub.setContexts(contexts);
+ TraceControlDialogFactory.getInstance().setAddContextDialog(addContextStub);
+
+ fFacility.executeCommand(domains[0], "addContextOnDomain");
+ // Currently there is nothing to verify because the list commands don't show any context information
+ // However, the execution of the command make sure that the correct service command line is build and executed.
+
+ // ------------------------------------------------------------------------
+ // Add Context on channel
+ // ------------------------------------------------------------------------
+
+ // Get Kernel domain component instance
+ domains = session.getChildren();
+ assertNotNull(domains);
+ assertEquals(1, domains.length);
+
+ //Verify that channel was created with correct data
+ channels = domains[0].getChildren();
+ channel = (TraceChannelComponent) channels[0];
+
+ try {
+ // The setContext() verifies that the contexts set are part of the available contexts
+ // The available contexts are set by the command handler addContextOnDomain above.
+ // So we indirectly test here that the parsing and setting of available contexts were
+ // done correctly above.
+ addContextStub.setContexts(contexts);
+ } catch (IllegalArgumentException e) {
+ fail("Exception caught - unknown context");
+ }
+
+ fFacility.executeCommand(channel, "addContextOnChannel");
+ // Currently there is nothing to verify because the list commands don't show any context information
+ // However, the execution of the command make sure that the correct service command line is build and executed.
+
+ // ------------------------------------------------------------------------
+ // Add Context on event
+ // ------------------------------------------------------------------------
+ // Get Kernel domain component instance
+ domains = session.getChildren();
+ assertNotNull(domains);
+ assertEquals(1, domains.length);
+
+ //Verify that channel was created with correct data
+ channels = domains[0].getChildren();
+ channel = (TraceChannelComponent) channels[2];
+
+ channel0Events = channel.getChildren();
+
+ event = (TraceEventComponent) channel0Events[6];
+
+ fFacility.executeCommand(event, "addContextOnEvent");
+ // Currently there is nothing to verify because the list commands don't show any context information
+ // However, the execution of the command make sure that the correct service command line is build and executed.
+
+ // ------------------------------------------------------------------------
+ // Calibrate
+ // ------------------------------------------------------------------------
+ // Get Kernel domain component instance
+ domains = session.getChildren();
+ assertNotNull(domains);
+ assertEquals(1, domains.length);
+
+ fFacility.executeCommand(domains[0], "calibrate");
+ // There is nothing to verify here.
+ // However, the execution of the command make sure that the correct service command line is build and executed.
// ------------------------------------------------------------------------
// refresh
fProxy.setScenario(TraceControlTestFacility.SCEN_SCENARIO_SESSION_HANDLING);
session = (TraceSessionComponent)groups[1].getChildren()[0];
-
+
// ------------------------------------------------------------------------
// start session
// ------------------------------------------------------------------------
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.KernelProviderComponent;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TargetNodeComponent;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceChannelComponent;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceEventComponent;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceProbeEventComponent;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceProviderGroup;
private static final String TEST_STREAM = "ListInfoTest.cfg";
private static final String SCEN_LIST_INFO_TEST = "ListInfoTest";
+ private static final String TARGET_NODE_NAME = "myNode";
// ------------------------------------------------------------------------
// Test data
IHost host = new Host(new SystemProfile("myProfile", true));
host.setHostName("127.0.0.1");
- TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, fProxy);
+ TargetNodeComponent node = new TargetNodeComponent(TARGET_NODE_NAME, root, host, fProxy);
root.addChild(node);
node.connect();
assertNotNull(channels);
assertEquals(2, channels.length);
+ // Verify setters and setters
+ verifyDomainGettersSetters((TraceDomainComponent) domains[0]);
+
// ------------------------------------------------------------------------
// Verify Kernel's channel0
// ------------------------------------------------------------------------
assertNull(probeEvent.getOffset());
assertNull(probeEvent.getSymbol());
+ // verify getters and setter
+ verifyProbeEventGettersSetters(probeEvent);
+
probeEvent = (TraceProbeEventComponent) channel0Events[3];
assertEquals("myevent0", probeEvent.getName());
assertEquals(TraceLogLevel.LEVEL_UNKNOWN, probeEvent.getLogLevel());
assertNotNull(activeImage);
assertNotSame(activeImage, inactiveImage);
+ ITraceControlComponent[] children = session.getChildren();
+ TraceDomainComponent[] domains = session.getDomains();
+
+ assertEquals(children.length, domains.length);
+
+ for (int i = 0; i < domains.length; i++) {
+ assertEquals(domains[i].getName(), children[i].getName());
+ }
// restore original values
session.setName(name);
session.setSessionPath(origPath);
session.setSessionState(origState);
}
+
+ private void verifyDomainGettersSetters(TraceDomainComponent domain) {
+ // save original values
+ boolean isKernel = domain.isKernel();
+
+ domain.setIsKernel(false);
+ assertFalse(domain.isKernel());
+ domain.setIsKernel(true);
+ assertTrue(domain.isKernel());
+
+ ITraceControlComponent[] children = domain.getChildren();
+ TraceChannelComponent[] channels = domain.getChannels();
+
+ assertEquals(children.length, channels.length);
+
+ for (int i = 0; i < channels.length; i++) {
+ assertEquals(channels[i].getName(), children[i].getName());
+ }
+
+ String nodeName = domain.getTargetNode().getName();
+ assertEquals(TARGET_NODE_NAME, nodeName);
+
+ // restore original values
+ domain.setIsKernel(isKernel);
+ }
private void verifyBaseEventGettersSetters(BaseEventComponent event) {
// save original values
event.setState(state);
}
+ private void verifyProbeEventGettersSetters(TraceProbeEventComponent event) {
+ // save original values
+ String address = event.getAddress();
+ String offset = event.getOffset();
+ String symbol = event.getSymbol();
+
+ // test cases
+ event.setAddress("0xffff1234");
+ assertEquals("0xffff1234", event.getAddress());
+
+ event.setOffset("0x1234");
+ assertEquals("0x1234", event.getOffset());
+
+ event.setSymbol("init");
+ assertEquals("init", event.getSymbol());
+
+ // restore original values
+ event.setAddress(address);
+ event.setOffset(offset);
+ event.setSymbol(symbol);
+ }
+
private void verifyChannelGettersSetters(TraceChannelComponent channel) {
// save original values
String name = channel.getName();
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
+import java.util.Set;
import junit.framework.TestCase;
private static final String SCEN_DESTROY_SESSION1 = "DestroySession1";
private static final String SCEN_CHANNEL_HANDLING = "ChannelHandling";
private static final String SCEN_EVENT_HANDLING = "EventHandling";
+ private static final String SCEN_CONTEXT_HANDLING = "ContextHandling";
+ private static final String SCEN_CONTEXT_ERROR_HANDLING = "ContextErrorHandling";
+ private static final String SCEN_CALIBRATE_HANDLING = "CalibrateHandling";
// ------------------------------------------------------------------------
// Test data
}
}
+ public void testAddContext() {
+ try {
+ // 1) session name, channel = null, 3 event names, kernel
+ String sessionName = "mysession2";
+ String channelName = "mychannel";
+ String eventName = "ust_tests_hello:tptest_sighandler";
+ List<String> contexts = new ArrayList<String>();
+ contexts.add("prio");
+ contexts.add("pid");
+
+ fShell.setScenario(SCEN_CONTEXT_HANDLING);
+
+ List<String> availContexts = fService.getContextList(new NullProgressMonitor());
+ assertNotNull(availContexts);
+ assertEquals(12, availContexts.size());
+
+ // A very "hard-coded" way to verify but it works ...
+ Set<String> expectedContexts = new HashSet<String>();
+ expectedContexts.add("pid");
+ expectedContexts.add("procname");
+ expectedContexts.add("prio");
+ expectedContexts.add("nice");
+ expectedContexts.add("vpid");
+ expectedContexts.add("tid");
+ expectedContexts.add("pthread_id");
+ expectedContexts.add("vtid");
+ expectedContexts.add("ppid");
+ expectedContexts.add("vppid");
+ expectedContexts.add("perf:cpu-cycles");
+ expectedContexts.add("perf:cycles");
+
+ assertTrue(expectedContexts.containsAll(availContexts));
+
+ // 1) session name, channel = null, event name, loglevel-only, TRACE_DEBUG
+ fService.addContexts(sessionName, channelName, eventName, false, contexts, new NullProgressMonitor());
+
+ } catch (ExecutionException e) {
+ fail(e.toString());
+ }
+ }
+
+ public void testAddContextFailure() {
+
+ // 1) session name, channel = null, 3 event names, kernel
+ String sessionName = "mysession2";
+ String channelName = "mychannel";
+ String eventName = "ust_tests_hello:tptest_sighandler";
+ List<String> contexts = new ArrayList<String>();
+ contexts.add("prio");
+ contexts.add("pid");
+ fShell.setScenario(SCEN_CONTEXT_ERROR_HANDLING);
+ try {
+ fService.getContextList(new NullProgressMonitor());
+ fail("No exeption generated");
+ } catch (ExecutionException e) {
+ // success
+ }
+ try {
+ // 1) session name, channel = null, event name, loglevel-only, TRACE_DEBUG
+ fService.addContexts(sessionName, channelName, eventName, false, contexts, new NullProgressMonitor());
+ fail("No exeption generated");
+ } catch (ExecutionException e) {
+ // success
+ }
+ }
+
+ public void testCalibrate() {
+ try {
+ fShell.setScenario(SCEN_CALIBRATE_HANDLING);
+ fService.calibrate(true, new NullProgressMonitor());
+
+ } catch (ExecutionException e) {
+ fail(e.toString());
+ }
+ }
+
+ public void testCalibrateFailure() {
+
+ try {
+ fShell.setScenario(SCEN_CALIBRATE_HANDLING);
+ fService.calibrate(false, new NullProgressMonitor());
+ fail("No exeption generated");
+ } catch (ExecutionException e) {
+ // success
+ }
+ }
+
}
--- /dev/null
+/**********************************************************************
+ * Copyright (c) 2012 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:
+ * Bernd Hufmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.linuxtools.internal.lttng2.stubs.dialogs;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IAddContextDialog;
+
+/**
+ * Add Context dialog stub.
+ */
+public class AddContextDialogStub implements IAddContextDialog {
+
+ private Set<String> fAvailableContexts = null;
+ private List<String> fContexts = null;
+
+ @Override
+ public int open() {
+ return 0;
+ }
+
+ @Override
+ public void setAvalibleContexts(List<String> contexts) {
+ fAvailableContexts = new HashSet<String>();
+ fAvailableContexts.addAll(contexts);
+ }
+
+ @Override
+ public List<String> getContexts() {
+ List<String> ret = new ArrayList<String>();
+ ret.addAll(fContexts);
+ return ret;
+ }
+
+ public void setContexts(List<String> contexts) throws IllegalArgumentException{
+ fContexts = new ArrayList<String>();
+ fContexts.addAll(contexts);
+ // If availableContexts are null we cannot verify
+ if (fAvailableContexts != null) {
+ for (Iterator<String> iterator = fContexts.iterator(); iterator.hasNext();) {
+ String string = (String) iterator.next();
+ if (!fAvailableContexts.contains(string)) {
+ throw new IllegalArgumentException();
+ }
+ }
+ }
+ }
+}
+
String[] output = new String[1];
output[0] = String.valueOf("Command not found");
- return new CommandResult(1, output);
+ CommandResult result = new CommandResult(0, null);
+ // For verification of setters of class CommandResult
+ result.setOutput(output);
+ result.setResult(1);
+ return result;
}
// ------------------------------------------------------------------------
</COMMAND_OUTPUT>
+<COMMAND_INPUT>
+lttng add-context -h
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+usage: lttng add-context -t TYPE
+
+If no channel and no event is given (-c/-e), the context
+will be added to all events and all channels.
+Otherwise the context will be added only to the channel (-c)
+and/or event (-e) indicated.
+Exactly one domain (-k/--kernel or -u/--userspace) must be specified.
+
+Options:
+ -h, --help Show this help
+ --list-options Simple listing of options
+ -s, --session NAME Apply to session name
+ -c, --channel NAME Apply to channel
+ -e, --event NAME Apply to event
+ -k, --kernel Apply to the kernel tracer
+ -u, --userspace Apply to the user-space tracer
+ -t, --type TYPE Context type. You can repeat that option on
+ the command line to specify multiple contexts at once.
+ (--kernel preempts --userspace)
+ TYPE can be one of the strings below:
+ pid, procname, prio, nice, vpid, tid, pthread_id,
+ vtid, ppid, vppid, perf:cpu-cycles, perf:cycles,
+ perf:stalled-cycles-frontend,
+ perf:idle-cycles-frontend,
+ perf:stalled-cycles-backend,
+ perf:idle-cycles-backend, perf:instructions,
+ perf:cache-references, perf:cache-misses,
+ perf:branch-instructions, perf:branches,
+ perf:branch-misses, perf:bus-cycles,
+ perf:L1-dcache-loads, perf:L1-dcache-load-misses,
+ perf:L1-dcache-stores,
+ perf:L1-dcache-store-misses,
+ perf:L1-dcache-prefetches,
+ perf:L1-dcache-prefetch-misses,
+ perf:L1-icache-loads, perf:L1-icache-load-misses,
+ perf:L1-icache-stores,
+ perf:L1-icache-store-misses,
+ perf:L1-icache-prefetches,
+ perf:L1-icache-prefetch-misses, perf:LLC-loads,
+ perf:LLC-load-misses, perf:LLC-stores,
+ perf:LLC-store-misses, perf:LLC-prefetches,
+ perf:LLC-prefetch-misses, perf:dTLB-loads,
+ perf:dTLB-load-misses, perf:dTLB-stores,
+ perf:dTLB-store-misses, perf:dTLB-prefetches,
+ perf:dTLB-prefetch-misses, perf:iTLB-loads,
+ perf:iTLB-load-misses, perf:branch-loads,
+ perf:branch-load-misses, perf:cpu-clock,
+ perf:task-clock, perf:page-fault, perf:faults,
+ perf:major-faults, perf:minor-faults,
+ perf:context-switches, perf:cs,
+ perf:cpu-migrations, perf:migrations,
+ perf:alignment-faults, perf:emulation-faults
+Example:
+This command will add the context information 'prio' and two perf
+counters (hardware branch misses and cache misses), to all events
+in the trace data output:
+# lttng add-context -k -t prio -t perf:branch-misses -t perf:cache-misses
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng add-context -s mysession -k -t prio -t perf:branch-misses -t perf:cache-misses
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+kernel context perf:cache-misses added to all channels
+kernel context perf:branch-misses added to all channels
+kernel context prio added to all channels
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing session mysession: [inactive]
+ Trace path: /home/user/lttng-traces/mysession-20120314-132824
+
+=== Domain: Kernel ===
+
+Channels:
+-------------
+- mychannel: [enabled]
+
+ Attributes:
+ overwrite mode: 1
+ subbufers size: 16384
+ number of subbufers: 4
+ switch timer interval: 100
+ read timer interval: 200
+ output: splice()
+
+ Events:
+ myevent (type: probe) [enabled]
+ offset: 0x2000
+ symbol: create_dev
+ syscalls (type: syscall) [enabled]
+
+- mychannel2: [enabled]
+
+ Attributes:
+ overwrite mode: 0
+ subbufers size: 32768
+ number of subbufers: 2
+ switch timer interval: 100
+ read timer interval: 200
+ output: splice()
+
+ Events:
+ sched_kthread_stop_ret (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+ sched_kthread_stop (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+ sched_wakeup_new (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+
+- channel0: [enabled]
+
+ Attributes:
+ overwrite mode: 0
+ subbufers size: 262144
+ number of subbufers: 4
+ switch timer interval: 0
+ read timer interval: 200
+ output: splice()
+
+ Events:
+ myevent5 (type: probe) [enabled]
+ offset: 0x2000
+ symbol: create_dev
+ myevent4 (type: probe) [enabled]
+ offset: 0x0
+ symbol: create_dev
+ myevent3 (type: probe) [enabled]
+ offset: 0x1000
+ symbol: init_post
+ myevent2 (type: probe) [enabled]
+ offset: 0x0
+ symbol: init_post
+ myevent1 (type: probe) [enabled]
+ addr: 0xc0101280
+ syscalls (type: syscall) [enabled]
+ sched_kthread_stop_ret (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+ sched_kthread_stop (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+ sched_wakeup_new (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng add-context -h
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+usage: lttng add-context -t TYPE
+
+If no channel and no event is given (-c/-e), the context
+will be added to all events and all channels.
+Otherwise the context will be added only to the channel (-c)
+and/or event (-e) indicated.
+Exactly one domain (-k/--kernel or -u/--userspace) must be specified.
+
+Options:
+ -h, --help Show this help
+ --list-options Simple listing of options
+ -s, --session NAME Apply to session name
+ -c, --channel NAME Apply to channel
+ -e, --event NAME Apply to event
+ -k, --kernel Apply to the kernel tracer
+ -u, --userspace Apply to the user-space tracer
+ -t, --type TYPE Context type. You can repeat that option on
+ the command line to specify multiple contexts at once.
+ (--kernel preempts --userspace)
+ TYPE can be one of the strings below:
+ pid, procname, prio, nice, vpid, tid, pthread_id,
+ vtid, ppid, vppid, perf:cpu-cycles, perf:cycles,
+ perf:stalled-cycles-frontend,
+ perf:idle-cycles-frontend,
+ perf:stalled-cycles-backend,
+ perf:idle-cycles-backend, perf:instructions,
+ perf:cache-references, perf:cache-misses,
+ perf:branch-instructions, perf:branches,
+ perf:branch-misses, perf:bus-cycles,
+ perf:L1-dcache-loads, perf:L1-dcache-load-misses,
+ perf:L1-dcache-stores,
+ perf:L1-dcache-store-misses,
+ perf:L1-dcache-prefetches,
+ perf:L1-dcache-prefetch-misses,
+ perf:L1-icache-loads, perf:L1-icache-load-misses,
+ perf:L1-icache-stores,
+ perf:L1-icache-store-misses,
+ perf:L1-icache-prefetches,
+ perf:L1-icache-prefetch-misses, perf:LLC-loads,
+ perf:LLC-load-misses, perf:LLC-stores,
+ perf:LLC-store-misses, perf:LLC-prefetches,
+ perf:LLC-prefetch-misses, perf:dTLB-loads,
+ perf:dTLB-load-misses, perf:dTLB-stores,
+ perf:dTLB-store-misses, perf:dTLB-prefetches,
+ perf:dTLB-prefetch-misses, perf:iTLB-loads,
+ perf:iTLB-load-misses, perf:branch-loads,
+ perf:branch-load-misses, perf:cpu-clock,
+ perf:task-clock, perf:page-fault, perf:faults,
+ perf:major-faults, perf:minor-faults,
+ perf:context-switches, perf:cs,
+ perf:cpu-migrations, perf:migrations,
+ perf:alignment-faults, perf:emulation-faults
+Example:
+This command will add the context information 'prio' and two perf
+counters (hardware branch misses and cache misses), to all events
+in the trace data output:
+# lttng add-context -k -t prio -t perf:branch-misses -t perf:cache-misses
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng add-context -s mysession -c mychannel -k -t prio -t perf:branch-misses -t perf:cache-misses
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+kernel context perf:cache-misses added to channel mychannel
+kernel context perf:branch-misses added to channel mychannel
+kernel context prio added to channel mychannel
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing session mysession: [inactive]
+ Trace path: /home/user/lttng-traces/mysession-20120314-132824
+
+=== Domain: Kernel ===
+
+Channels:
+-------------
+- mychannel: [enabled]
+
+ Attributes:
+ overwrite mode: 1
+ subbufers size: 16384
+ number of subbufers: 4
+ switch timer interval: 100
+ read timer interval: 200
+ output: splice()
+
+ Events:
+ myevent (type: probe) [enabled]
+ offset: 0x2000
+ symbol: create_dev
+ syscalls (type: syscall) [enabled]
+
+- mychannel2: [enabled]
+
+ Attributes:
+ overwrite mode: 0
+ subbufers size: 32768
+ number of subbufers: 2
+ switch timer interval: 100
+ read timer interval: 200
+ output: splice()
+
+ Events:
+ sched_kthread_stop_ret (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+ sched_kthread_stop (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+ sched_wakeup_new (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+
+- channel0: [enabled]
+
+ Attributes:
+ overwrite mode: 0
+ subbufers size: 262144
+ number of subbufers: 4
+ switch timer interval: 0
+ read timer interval: 200
+ output: splice()
+
+ Events:
+ myevent5 (type: probe) [enabled]
+ offset: 0x2000
+ symbol: create_dev
+ myevent4 (type: probe) [enabled]
+ offset: 0x0
+ symbol: create_dev
+ myevent3 (type: probe) [enabled]
+ offset: 0x1000
+ symbol: init_post
+ myevent2 (type: probe) [enabled]
+ offset: 0x0
+ symbol: init_post
+ myevent1 (type: probe) [enabled]
+ addr: 0xc0101280
+ syscalls (type: syscall) [enabled]
+ sched_kthread_stop_ret (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+ sched_kthread_stop (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+ sched_wakeup_new (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng add-context -h
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+usage: lttng add-context -t TYPE
+
+If no channel and no event is given (-c/-e), the context
+will be added to all events and all channels.
+Otherwise the context will be added only to the channel (-c)
+and/or event (-e) indicated.
+Exactly one domain (-k/--kernel or -u/--userspace) must be specified.
+
+Options:
+ -h, --help Show this help
+ --list-options Simple listing of options
+ -s, --session NAME Apply to session name
+ -c, --channel NAME Apply to channel
+ -e, --event NAME Apply to event
+ -k, --kernel Apply to the kernel tracer
+ -u, --userspace Apply to the user-space tracer
+ -t, --type TYPE Context type. You can repeat that option on
+ the command line to specify multiple contexts at once.
+ (--kernel preempts --userspace)
+ TYPE can be one of the strings below:
+ pid, procname, prio, nice, vpid, tid, pthread_id,
+ vtid, ppid, vppid, perf:cpu-cycles, perf:cycles,
+ perf:stalled-cycles-frontend,
+ perf:idle-cycles-frontend,
+ perf:stalled-cycles-backend,
+ perf:idle-cycles-backend, perf:instructions,
+ perf:cache-references, perf:cache-misses,
+ perf:branch-instructions, perf:branches,
+ perf:branch-misses, perf:bus-cycles,
+ perf:L1-dcache-loads, perf:L1-dcache-load-misses,
+ perf:L1-dcache-stores,
+ perf:L1-dcache-store-misses,
+ perf:L1-dcache-prefetches,
+ perf:L1-dcache-prefetch-misses,
+ perf:L1-icache-loads, perf:L1-icache-load-misses,
+ perf:L1-icache-stores,
+ perf:L1-icache-store-misses,
+ perf:L1-icache-prefetches,
+ perf:L1-icache-prefetch-misses, perf:LLC-loads,
+ perf:LLC-load-misses, perf:LLC-stores,
+ perf:LLC-store-misses, perf:LLC-prefetches,
+ perf:LLC-prefetch-misses, perf:dTLB-loads,
+ perf:dTLB-load-misses, perf:dTLB-stores,
+ perf:dTLB-store-misses, perf:dTLB-prefetches,
+ perf:dTLB-prefetch-misses, perf:iTLB-loads,
+ perf:iTLB-load-misses, perf:branch-loads,
+ perf:branch-load-misses, perf:cpu-clock,
+ perf:task-clock, perf:page-fault, perf:faults,
+ perf:major-faults, perf:minor-faults,
+ perf:context-switches, perf:cs,
+ perf:cpu-migrations, perf:migrations,
+ perf:alignment-faults, perf:emulation-faults
+Example:
+This command will add the context information 'prio' and two perf
+counters (hardware branch misses and cache misses), to all events
+in the trace data output:
+# lttng add-context -k -t prio -t perf:branch-misses -t perf:cache-misses
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng add-context -s mysession -c channel0 -e sched_kthread_stop_ret -k -t prio -t perf:branch-misses -t perf:cache-misses
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+kernel context perf:cache-misses added to event sched_kthread_stop_ret channel mychannel
+kernel context perf:branch-misses added to event sched_kthread_stop_ret channel mychannel
+kernel context prio added to channel event sched_kthread_stop_ret mychannel
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Tracing session mysession: [inactive]
+ Trace path: /home/user/lttng-traces/mysession-20120314-132824
+
+=== Domain: Kernel ===
+
+Channels:
+-------------
+- mychannel: [enabled]
+
+ Attributes:
+ overwrite mode: 1
+ subbufers size: 16384
+ number of subbufers: 4
+ switch timer interval: 100
+ read timer interval: 200
+ output: splice()
+
+ Events:
+ myevent (type: probe) [enabled]
+ offset: 0x2000
+ symbol: create_dev
+ syscalls (type: syscall) [enabled]
+
+- mychannel2: [enabled]
+
+ Attributes:
+ overwrite mode: 0
+ subbufers size: 32768
+ number of subbufers: 2
+ switch timer interval: 100
+ read timer interval: 200
+ output: splice()
+
+ Events:
+ sched_kthread_stop_ret (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+ sched_kthread_stop (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+ sched_wakeup_new (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+
+- channel0: [enabled]
+
+ Attributes:
+ overwrite mode: 0
+ subbufers size: 262144
+ number of subbufers: 4
+ switch timer interval: 0
+ read timer interval: 200
+ output: splice()
+
+ Events:
+ myevent5 (type: probe) [enabled]
+ offset: 0x2000
+ symbol: create_dev
+ myevent4 (type: probe) [enabled]
+ offset: 0x0
+ symbol: create_dev
+ myevent3 (type: probe) [enabled]
+ offset: 0x1000
+ symbol: init_post
+ myevent2 (type: probe) [enabled]
+ offset: 0x0
+ symbol: init_post
+ myevent1 (type: probe) [enabled]
+ addr: 0xc0101280
+ syscalls (type: syscall) [enabled]
+ sched_kthread_stop_ret (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+ sched_kthread_stop (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+ sched_wakeup_new (loglevel: TRACE_EMERG (0)) (type: tracepoint) [enabled]
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng calibrate -k --function
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Kernel calibration done
+</COMMAND_OUTPUT>
+
</SCENARIO>
<SCENARIO>
</SCENARIO>
+####################################################################
+# Scenario: Test "lttng add-context -h" and lttng add-context ..." with different inputs
+####################################################################
+
+<SCENARIO>
+ContextHandling
+
+<COMMAND_INPUT>
+lttng add-context -h
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+usage: lttng add-context -t TYPE
+
+If no channel and no event is given (-c/-e), the context
+will be added to all events and all channels.
+Otherwise the context will be added only to the channel (-c)
+and/or event (-e) indicated.
+Exactly one domain (-k/--kernel or -u/--userspace) must be specified.
+
+Options:
+ -h, --help Show this help
+ --list-options Simple listing of options
+ -s, --session NAME Apply to session name
+ -c, --channel NAME Apply to channel
+ -e, --event NAME Apply to event
+ -k, --kernel Apply to the kernel tracer
+ -u, --userspace Apply to the user-space tracer
+ -t, --type TYPE Context type. You can repeat that option on
+ the command line to specify multiple contexts at once.
+ (--kernel preempts --userspace)
+ TYPE can be one of the strings below:
+ pid, procname, prio, nice, vpid, tid, pthread_id,
+ vtid, ppid, vppid, perf:cpu-cycles, perf:cycles
+Example:
+This command will add the context information 'prio' and two perf
+counters (hardware branch misses and cache misses), to all events
+in the trace data output:
+# lttng add-context -k -t prio -t perf:branch-misses -t perf:cache-misses
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng add-context -s mysession2 -c mychannel -e ust_tests_hello:tptest_sighandler -u -t prio -t pid
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+UST context prio added to event ust_tests_hello:tptest_sighandle channel mychannel
+UST context pid added to event sched_kthread_stop_ret channel mychannel
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+<SCENARIO>
+ContextErrorHandling
+
+<COMMAND_INPUT>
+lttng add-context -h
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+1
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+usage: lttng add-context -t TYPE
+If no channel and no event is given (-c/-e), the context
+will be added to all events and all channels.
+Otherwise the context will be added only to the channel (-c)
+and/or event (-e) indicated.
+Exactly one domain (-k/--kernel or -u/--userspace) must be specified.
+
+Options:
+ -h, --help Show this help
+ --list-options Simple listing of options
+ -s, --session NAME Apply to session name
+ -c, --channel NAME Apply to channel
+ -e, --event NAME Apply to event
+ -k, --kernel Apply to the kernel tracer
+ -u, --userspace Apply to the user-space tracer
+ -t, --type TYPE Context type. You can repeat that option on
+ the command line to specify multiple contexts at once.
+ (--kernel preempts --userspace)
+ TYPE can be one of the strings below:
+ pid, procname, prio, nice, vpid, tid, pthread_id,
+ vtid, ppid, vppid, perf:cpu-cycles, perf:cycles
+Example:
+This command will add the context information 'prio' and two perf
+counters (hardware branch misses and cache misses), to all events
+in the trace data output:
+# lttng add-context -k -t prio -t perf:branch-misses -t perf:cache-misses
+
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng add-context -s mysession2 -c mychannel -e ust_tests_hello:tptest_sighandler -u -t prio -t pid
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+1
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+UST context prio added to event ust_tests_hello:tptest_sighandle channel mychannel
+UST context pid added to event sched_kthread_stop_ret channel mychannel
+</COMMAND_OUTPUT>
+
+</SCENARIO>
+
+<SCENARIO>
+CalibrateHandling
+<COMMAND_INPUT>
+lttng calibrate -k --function
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Kernel calibration done
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng calibrate -u --function
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+1
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Kernel calibration done
+</COMMAND_OUTPUT>
+
+</SCENARIO>
*/
public void setName(String name);
- /**
- * @return a formated (readable) String with content.
- */
- public String formatString();
}
}
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceInfo#formatString()
- */
- @SuppressWarnings("nls")
- @Override
- public String formatString() {
- StringBuffer output = new StringBuffer();
- // ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_MODULE (10)) (type: tracepoint)");
- output.append("\n ");
- output.append(getName());
- if (fLogLevel != TraceLogLevel.LEVEL_UNKNOWN) {
- output.append(" (loglevel: ");
- output.append(fLogLevel.getInName());
- output.append(" (");
- output.append(fLogLevel.ordinal());
- output.append("))");
- }
- output.append(" (type: ");
- output.append(fEventType.getInName());
- output.append(')');
- return output.toString();
- }
-
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#hashCode()
fEvents.add(channel);
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceInfo#formatString()
- */
- @SuppressWarnings("nls")
- @Override
- public String formatString() {
- StringBuffer output = new StringBuffer();
- //- channel0: [enabled]
- output.append("\n- ");
- output.append(getName());
- output.append(": [");
- output.append(getState().getInName());
- output.append("]\n");
- // Attributes:
- output.append("\n Attributes:\n");
- // overwrite mode: 0
- output.append(" overwrite mode: ");
- output.append(isOverwriteMode() ? "1" : "0");
- // subbufers size: 262144
- output.append("\n subbufers size: ");
- output.append(getSubBufferSize());
- // number of subbufers: 4
- output.append("\n number of subbufers: ");
- output.append(getNumberOfSubBuffers());
- // switch timer interval: 0
- output.append("\n switch timer interval: ");
- output.append(getSwitchTimer());
- // read timer interval: 200
- output.append("\n read timer interval: ");
- output.append(getReadTimer());
- // output: splice()
- output.append("\n output: ");
- output.append(getOutputType());
- output.append("\n\n");
-
- output.append(" Events:");
- if (fEvents.isEmpty()) {
- output.append("\n None");
- } else {
- for (Iterator<IEventInfo> iterator = fEvents.iterator(); iterator.hasNext();) {
- IEventInfo event = (IEventInfo) iterator.next();
- output.append(event.formatString());
- }
- }
- output.append('\n');
-
- return output.toString();
- }
-
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#hashCode()
fChannels.add(channel);
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceInfo#formatString()
- */
- @SuppressWarnings("nls")
- @Override
- public String formatString() {
- StringBuffer output = new StringBuffer();
- //=== Domain: Kernel ===
- output.append("\n=== Domain: ");
- output.append(getName());
- output.append(" ===\n");
- output.append("\n");
- // Channels:
- output.append("Channels:\n");
- // -------------
- output.append("-------------");
- if (fChannels.isEmpty()) {
- output.append("\nNone");
- } else {
- for (Iterator<IChannelInfo> iterator = fChannels.iterator(); iterator.hasNext();) {
- IChannelInfo channel = (IChannelInfo) iterator.next();
- output.append(channel.formatString());
- }
- }
- output.append('\n');
- return output.toString();
- }
-
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#hashCode()
fState = state;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceInfo#formatString()
- */
- @SuppressWarnings("nls")
- @Override
- public String formatString() {
- StringBuffer output = new StringBuffer();
- // ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_MODULE (10)) (type: tracepoint) [enabled]");
- output.append(super.formatString());
- output.append(" [");
- output.append(fState.getInName());
- output.append(']');
- return output.toString();
- }
-
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IEventInfo#setState(java.lang.String)
// ------------------------------------------------------------------------
// Operation
// ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceInfo#formatString()
- */
- @SuppressWarnings("nls")
- @Override
- public String formatString() {
- StringBuffer output = new StringBuffer();
- // name (type: probe) [enabled]");
- // address:
- output.append(super.formatString());
- if (fAddress != null) {
- output.append("\n addr: ");
- output.append(fAddress);
- } else {
- output.append("\n offset: ");
- output.append(fOffset);
- output.append('\n');
- output.append(" symbol: ");
- output.append(fSymbol);
- }
- return output.toString();
- }
-
+
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.BaseEventInfo#hashCode()
return output.toString();
}
-
}
public void addDomain(IDomainInfo domainInfo) {
fDomains.add(domainInfo);
}
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceInfo#formatString()
- */
- @Override
- @SuppressWarnings("nls")
- public String formatString() {
- StringBuffer output = new StringBuffer();
- // Tracing session mysession: [active]
- output.append("Tracing session ");
- output.append(getName());
- output.append(": [");
- output.append(getSessionState().getInName());
- output.append("]\n");
-
- // Trace path: /home/user/lttng-traces/mysession-20120129-084256
- output.append(" Trace path: ");
- output.append(getSessionPath());
- output.append('\n');
-
- for (Iterator<IDomainInfo> iterator = fDomains.iterator(); iterator.hasNext();) {
- IDomainInfo domain = (IDomainInfo) iterator.next();
- output.append(domain.formatString());
- }
- return output.toString();
- }
/*
* (non-Javadoc)
fName = name;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceInfo#formatString()
- */
- @Override
- public String formatString() {
- return toString();
- }
-
/*
* (non-Javadoc)
* @see java.lang.Object#hashCode()
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceInfo#formatString()
- */
- @SuppressWarnings("nls")
- @Override
- public String formatString() {
- StringBuffer output = new StringBuffer();
- //PID: 9379 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
- output.append("\nPID: ");
- output.append(fPid);
- output.append(" - Name: ");
- output.append(getName());
- for (Iterator<IBaseEventInfo> iterator = fEvents.iterator(); iterator.hasNext();) {
- IBaseEventInfo event = (IBaseEventInfo) iterator.next();
- output.append(event.formatString());
- }
- output.append("\n");
- return output.toString();
- }
-
-
/*
* (non-Javadoc)
* @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceInfo#hashCode()