Add copyright header.
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.core / src / org / eclipse / linuxtools / internal / lttng / core / trace / LTTngTrace.java
CommitLineData
5d10d135 1/*******************************************************************************
a3767fd9 2 * Copyright (c) 2009, 2011 Ericsson, MontaVista Software
5d10d135
ASL
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * William Bourque (wbourque@gmail.com) - Initial API and implementation
a3767fd9 11 * Yufen Kuo (ykuo@mvista.com) - add support to allow user specify trace library path
5d10d135
ASL
12 *******************************************************************************/
13
5945cec9 14package org.eclipse.linuxtools.internal.lttng.core.trace;
5d10d135 15
28b94d61
FC
16import java.util.HashMap;
17import java.util.Iterator;
18import java.util.Vector;
19
12c155f5 20import org.eclipse.core.resources.IProject;
25e48683 21import org.eclipse.core.resources.IResource;
5945cec9
FC
22import org.eclipse.linuxtools.internal.lttng.core.TraceHelper;
23import org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent;
24import org.eclipse.linuxtools.internal.lttng.core.event.LttngEventContent;
25import org.eclipse.linuxtools.internal.lttng.core.event.LttngEventType;
26import org.eclipse.linuxtools.internal.lttng.core.event.LttngLocation;
27import org.eclipse.linuxtools.internal.lttng.core.event.LttngTimestamp;
28import org.eclipse.linuxtools.internal.lttng.core.exceptions.LttngException;
29import org.eclipse.linuxtools.internal.lttng.core.tracecontrol.utility.LiveTraceManager;
ce38c104 30import org.eclipse.linuxtools.internal.lttng.jni.common.JniTime;
5d10d135 31import org.eclipse.linuxtools.lttng.jni.JniEvent;
28b94d61 32import org.eclipse.linuxtools.lttng.jni.JniMarker;
5d10d135 33import org.eclipse.linuxtools.lttng.jni.JniTrace;
28b94d61 34import org.eclipse.linuxtools.lttng.jni.JniTracefile;
004f471b 35import org.eclipse.linuxtools.lttng.jni.factory.JniTraceFactory;
4df4581d 36import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
1b70b6dc 37import org.eclipse.linuxtools.tmf.core.event.TmfEvent;
6c13869b
FC
38import org.eclipse.linuxtools.tmf.core.event.TmfTimeRange;
39import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;
b4f71e4a 40import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
1b70b6dc
PT
41import org.eclipse.linuxtools.tmf.core.request.ITmfDataRequest.ExecutionType;
42import org.eclipse.linuxtools.tmf.core.request.TmfEventRequest;
43import org.eclipse.linuxtools.tmf.core.signal.TmfTraceUpdatedSignal;
6c13869b 44import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;
7e6347b0 45import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;
6c13869b 46import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;
a5f08d16 47import org.eclipse.linuxtools.tmf.core.trace.TmfCheckpointIndexer;
6c13869b 48import org.eclipse.linuxtools.tmf.core.trace.TmfContext;
9e0640dc 49import org.eclipse.linuxtools.tmf.core.trace.TmfExperiment;
6c13869b 50import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
5d10d135 51
3fbd810a 52class LTTngTraceException extends LttngException {
cbdacf03 53
12c155f5 54 static final long serialVersionUID = -1636648737081868146L;
3fbd810a 55
cbdacf03 56 public LTTngTraceException(final String errMsg) {
12c155f5
FC
57 super(errMsg);
58 }
3fbd810a
FC
59}
60
5d10d135 61/**
64fe8e8a
FC
62 * <b><u>LTTngTrace</u></b>
63 * <p>
07d9e2ee 64 *
cbdacf03
FC
65 * LTTng trace implementation. It accesses the C trace handling library
66 * (seeking, reading and parsing) through the JNI component.
5d10d135 67 */
7e6347b0 68public class LTTngTrace extends TmfTrace<LttngEvent> implements ITmfEventParser<LttngEvent> {
9b635e61 69
212550ba
FC
70 public final static boolean PRINT_DEBUG = false;
71 public final static boolean UNIQUE_EVENT = true;
12c155f5
FC
72
73 private final static boolean SHOW_LTT_DEBUG_DEFAULT = false;
212550ba 74 private final static boolean IS_PARSING_NEEDED_DEFAULT = !UNIQUE_EVENT;
12c155f5 75 private final static int CHECKPOINT_PAGE_SIZE = 50000;
1b70b6dc 76 private final static long LTTNG_STREAMING_INTERVAL = 2000; // in ms
12c155f5
FC
77
78 // Reference to our JNI trace
c5b45b39
FC
79 private JniTrace currentJniTrace;
80
81 LttngTimestamp eventTimestamp;
99005796 82 String eventSource;
c5b45b39 83 LttngEventContent eventContent;
4641c2f7 84 String eventReference;
12c155f5
FC
85
86 // The actual event
c5b45b39 87 LttngEvent currentLttngEvent;
12c155f5
FC
88
89 // The current location
c5b45b39
FC
90 LttngLocation previousLocation;
91
92 LttngEventType eventType;
12c155f5 93
12c155f5 94 // Hashmap of the possible types of events (Tracefile/CPU/Marker in the JNI)
c5b45b39 95 HashMap<Integer, LttngEventType> traceTypes;
cbdacf03 96
12c155f5 97 // This vector will be used to quickly find a marker name from a position
c5b45b39 98 Vector<Integer> traceTypeNames;
cbdacf03 99
c5b45b39 100 private String traceLibPath;
12c155f5
FC
101
102 public LTTngTrace() {
103 }
104
f4c52cea 105 @Override
cbdacf03 106 public boolean validate(final IProject project, final String path) {
2352aed9 107 if (fileExists(path)) {
cbdacf03 108 final String traceLibPath = TraceHelper.getTraceLibDirFromProject(project);
12c155f5 109 try {
cbdacf03 110 final LTTngTraceVersion version = new LTTngTraceVersion(path, traceLibPath);
12c155f5 111 return version.isValidLttngTrace();
cbdacf03 112 } catch (final LttngException e) {
12c155f5
FC
113 }
114 }
115 return false;
116 }
117
a5f08d16 118 @SuppressWarnings({ "unchecked", "rawtypes" })
f4c52cea 119 @Override
25e48683 120 public synchronized void initTrace(final IResource resource, final String path, final Class<LttngEvent> eventType)
b4f71e4a 121 throws TmfTraceException {
09e86496 122 super.initialize(resource, path, eventType);
a5f08d16 123 setIndexer(new TmfCheckpointIndexer(this, getCacheSize()));
09e86496
FC
124 initialize(resource, path, eventType);
125 }
126
127 @Override
128 protected synchronized void initialize(final IResource resource, final String path, final Class<LttngEvent> eventType)
b4f71e4a 129 throws TmfTraceException {
12c155f5
FC
130 try {
131 currentJniTrace = JniTraceFactory.getJniTrace(path, traceLibPath, SHOW_LTT_DEBUG_DEFAULT);
cbdacf03 132 } catch (final Exception e) {
b4f71e4a 133 throw new TmfTraceException(e.getMessage());
12c155f5
FC
134 }
135
136 // Export all the event types from the JNI side
137 traceTypes = new HashMap<Integer, LttngEventType>();
138 traceTypeNames = new Vector<Integer>();
139 initialiseEventTypes(currentJniTrace);
140
00641a97 141 // Build the re-used event structure
12c155f5 142 eventTimestamp = new LttngTimestamp();
4641c2f7 143 eventSource = ""; //$NON-NLS-1$
12c155f5
FC
144 this.eventType = new LttngEventType();
145 eventContent = new LttngEventContent(currentLttngEvent);
4641c2f7 146 eventReference = getName();
12c155f5
FC
147
148 // Create the skeleton event
149 currentLttngEvent = new LttngEvent(this, eventTimestamp, eventSource, this.eventType, eventContent,
150 eventReference, null);
151
152 // Create a new current location
153 previousLocation = new LttngLocation();
154
155 // Set the currentEvent to the eventContent
156 eventContent.setEvent(currentLttngEvent);
157
0316808c
FC
158 setParser((ITmfEventParser<LttngEvent>) this);
159 setCacheSize(CHECKPOINT_PAGE_SIZE);
b4f71e4a 160
1b70b6dc
PT
161 // // Bypass indexing if asked
162 // if ( bypassIndexing == false ) {
163 // indexTrace(true);
164 // }
165 // else {
166 // Even if we don't have any index, set ONE checkpoint
167 // fCheckpoints.add(new TmfCheckpoint(new LttngTimestamp(0L) , new
168 // LttngLocation() ) );
169
170 initializeStreamingMonitor();
171 }
172
173 private void initializeStreamingMonitor() {
cbdacf03
FC
174 final JniTrace jniTrace = getCurrentJniTrace();
175 if (jniTrace == null
176 || (!jniTrace.isLiveTraceSupported() || !LiveTraceManager.isLiveTrace(jniTrace.getTracepath()))) {
1b70b6dc 177 // Set the time range of the trace
07671572 178 final ITmfContext context = seekEvent(0);
c32744d6 179 final LttngEvent event = getNext(context);
cbdacf03
FC
180 final LttngTimestamp startTime = new LttngTimestamp(event.getTimestamp());
181 final LttngTimestamp endTime = new LttngTimestamp(currentJniTrace.getEndTime().getTime());
1b70b6dc 182 setTimeRange(new TmfTimeRange(startTime, endTime));
cbdacf03 183 final TmfTraceUpdatedSignal signal = new TmfTraceUpdatedSignal(this, this, getTimeRange());
1b70b6dc
PT
184 broadcast(signal);
185 return;
186 }
187
12c155f5 188 // Set the time range of the trace
07671572 189 final ITmfContext context = seekEvent(0);
c32744d6 190 final LttngEvent event = getNext(context);
a4115405
FC
191 setEndTime(TmfTimestamp.BIG_BANG);
192 final long startTime = event != null ? event.getTimestamp().getValue() : TmfTimestamp.BIG_BANG.getValue();
0316808c 193 setStreamingInterval(LTTNG_STREAMING_INTERVAL);
1b70b6dc
PT
194
195 final Thread thread = new Thread("Streaming Monitor for trace " + getName()) { //$NON-NLS-1$
cbdacf03 196
1b70b6dc
PT
197 LttngTimestamp safeTimestamp = null;
198 TmfTimeRange timeRange = null;
199
f4c52cea 200 @SuppressWarnings("unchecked")
1b70b6dc
PT
201 @Override
202 public void run() {
203 while (!fExecutor.isShutdown()) {
cbdacf03 204 final TmfExperiment<?> experiment = TmfExperiment.getCurrentExperiment();
1b70b6dc 205 if (experiment != null) {
f4c52cea 206 @SuppressWarnings("rawtypes")
cbdacf03
FC
207 final TmfEventRequest request = new TmfEventRequest<TmfEvent>(TmfEvent.class,
208 TmfTimeRange.ETERNITY, 0, ExecutionType.FOREGROUND) {
209
1b70b6dc
PT
210 @Override
211 public void handleCompleted() {
212 updateJniTrace();
213 }
214 };
215 synchronized (experiment) {
216 experiment.sendRequest(request);
217 }
218 try {
219 request.waitForCompletion();
cbdacf03 220 } catch (final InterruptedException e) {
1b70b6dc 221 }
cbdacf03 222 } else
1b70b6dc 223 updateJniTrace();
1b70b6dc
PT
224 try {
225 Thread.sleep(LTTNG_STREAMING_INTERVAL);
cbdacf03 226 } catch (final InterruptedException e) {
1b70b6dc
PT
227 }
228 }
229 }
cbdacf03 230
1b70b6dc 231 private void updateJniTrace() {
cbdacf03 232 final JniTrace jniTrace = getCurrentJniTrace();
1b70b6dc 233 currentJniTrace.updateTrace();
cbdacf03
FC
234 final long endTime = jniTrace.getEndTime().getTime();
235 final LttngTimestamp startTimestamp = new LttngTimestamp(startTime);
236 final LttngTimestamp endTimestamp = new LttngTimestamp(endTime);
237 if (safeTimestamp != null && safeTimestamp.compareTo(getTimeRange().getEndTime(), false) > 0)
1b70b6dc 238 timeRange = new TmfTimeRange(startTimestamp, safeTimestamp);
cbdacf03 239 else
1b70b6dc 240 timeRange = null;
1b70b6dc 241 safeTimestamp = endTimestamp;
cbdacf03 242 if (timeRange != null)
1b70b6dc 243 setTimeRange(timeRange);
1b70b6dc
PT
244 }
245 };
246 thread.start();
247 }
c5b45b39 248
12c155f5
FC
249 /**
250 * Default Constructor.
251 * <p>
12c155f5 252 *
cbdacf03
FC
253 * @param name Name of the trace
254 * @param path Path to a <b>directory</b> that contain an LTTng trace.
255 *
256 * @exception Exception (most likely LTTngTraceException or
257 * FileNotFoundException)
12c155f5 258 */
25e48683 259 public LTTngTrace(final IResource resource, final String path) throws Exception {
12c155f5 260 // Call with "wait for completion" true and "skip indexing" false
25e48683 261 this(resource, path, null, true, false);
12c155f5
FC
262 }
263
264 /**
265 * Constructor, with control over the indexing.
266 * <p>
267 *
cbdacf03
FC
268 * @param name Name of the trace
269 * @param path Path to a <b>directory</b> that contain an LTTng trace.
270 * @param waitForCompletion Should we wait for indexign to complete before
271 * moving on.
12c155f5 272 *
cbdacf03
FC
273 * @exception Exception (most likely LTTngTraceException or
274 * FileNotFoundException)
12c155f5 275 */
25e48683 276 public LTTngTrace(final IResource resource, final String path, final boolean waitForCompletion) throws Exception {
12c155f5 277 // Call with "skip indexing" false
25e48683 278 this(resource, path, null, waitForCompletion, true);
12c155f5
FC
279 }
280
281 /**
cbdacf03
FC
282 * Default constructor, with control over the indexing and possibility to
283 * bypass indexation
12c155f5
FC
284 * <p>
285 *
cbdacf03
FC
286 * @param name Name of the trace
287 * @param path Path to a <b>directory</b> that contain an LTTng trace.
288 * @param traceLibPath Path to a <b>directory</b> that contains LTTng trace
289 * libraries.
290 * @param waitForCompletion Should we wait for indexign to complete before
291 * moving on.
292 * @param bypassIndexing Should we bypass indexing completly? This is should
293 * only be useful for unit testing.
12c155f5 294 *
cbdacf03
FC
295 * @exception Exception (most likely LTTngTraceException or
296 * FileNotFoundException)
12c155f5
FC
297 *
298 */
25e48683 299 public LTTngTrace(final IResource resource, final String path, final String traceLibPath, final boolean waitForCompletion,
cbdacf03 300 final boolean bypassIndexing)
f17b2f70 301 throws Exception {
09e86496
FC
302 // super(resource, LttngEvent.class, path, CHECKPOINT_PAGE_SIZE, false);
303 super(resource, LttngEvent.class, path, CHECKPOINT_PAGE_SIZE);
304 initialize(resource, path, LttngEvent.class);
20658947
FC
305// if (!bypassIndexing)
306// indexTrace(false);
12c155f5 307 this.traceLibPath = traceLibPath;
12c155f5
FC
308 }
309
310 /*
311 * Copy constructor is forbidden for LttngEvenmStream
312 */
cbdacf03 313 public LTTngTrace(final LTTngTrace other) throws Exception {
25e48683 314 this(other.getResource(), other.getPath(), other.getTraceLibPath(), false, true);
d337369a 315// this.fCheckpoints = other.fCheckpoints;
00641a97 316 setTimeRange(new TmfTimeRange(new LttngTimestamp(other.getStartTime()), new LttngTimestamp(other.getEndTime())));
12c155f5
FC
317 }
318
f17b2f70
FC
319 // @Override
320 // public synchronized LTTngTrace clone() {
321 // LTTngTrace clone = null;
322 // clone = (LTTngTrace) super.clone();
323 // try {
324 // clone.currentJniTrace = JniTraceFactory.getJniTrace(getPath(), getTraceLibPath(),
325 // SHOW_LTT_DEBUG_DEFAULT);
326 // } catch (final JniException e) {
327 // // e.printStackTrace();
328 // }
329 //
330 // // Export all the event types from the JNI side
331 // clone.traceTypes = new HashMap<Integer, LttngEventType>();
332 // clone.traceTypeNames = new Vector<Integer>();
333 // clone.initialiseEventTypes(clone.currentJniTrace);
334 //
335 // // Verify that all those "default constructor" are safe to use
336 // clone.eventTimestamp = new LttngTimestamp();
337 // clone.eventSource = ""; //$NON-NLS-1$
338 // clone.eventType = new LttngEventType();
339 // clone.eventContent = new LttngEventContent(clone.currentLttngEvent);
340 // clone.eventReference = getName();
341 //
342 // // Create the skeleton event
343 // clone.currentLttngEvent = new LttngEvent(this, clone.eventTimestamp, clone.eventSource, clone.eventType,
344 // clone.eventContent, clone.eventReference, null);
345 //
346 // // Create a new current location
347 // clone.previousLocation = new LttngLocation();
348 //
349 // // Set the currentEvent to the eventContent
350 // clone.eventContent.setEvent(clone.currentLttngEvent);
351 //
352 // // Set the start time of the trace
353 // setTimeRange(new TmfTimeRange(new LttngTimestamp(clone.currentJniTrace.getStartTime().getTime()),
354 // new LttngTimestamp(clone.currentJniTrace.getEndTime().getTime())));
355 //
356 // return clone;
357 // }
12c155f5
FC
358
359 public String getTraceLibPath() {
360 return traceLibPath;
361 }
362
363 /*
364 * Fill out the HashMap with "Type" (Tracefile/Marker)
365 *
366 * This should be called at construction once the trace is open
367 */
cbdacf03 368 private void initialiseEventTypes(final JniTrace trace) {
12c155f5
FC
369 // Work variables
370 LttngEventType tmpType = null;
371 String[] markerFieldsLabels = null;
372
373 String newTracefileKey = null;
374 Integer newMarkerKey = null;
375
376 JniTracefile newTracefile = null;
377 JniMarker newMarker = null;
378
379 // First, obtain an iterator on TRACEFILES of owned by the TRACE
cbdacf03 380 final Iterator<String> tracefileItr = trace.getTracefilesMap().keySet().iterator();
12c155f5
FC
381
382 while (tracefileItr.hasNext()) {
383 newTracefileKey = tracefileItr.next();
384 newTracefile = trace.getTracefilesMap().get(newTracefileKey);
385
386 // From the TRACEFILE read, obtain its MARKER
cbdacf03 387 final Iterator<Integer> markerItr = newTracefile.getTracefileMarkersMap().keySet().iterator();
12c155f5
FC
388 while (markerItr.hasNext()) {
389 newMarkerKey = markerItr.next();
390 newMarker = newTracefile.getTracefileMarkersMap().get(newMarkerKey);
391
392 // From the MARKER we can obtain the MARKERFIELDS keys (i.e.
393 // labels)
394 markerFieldsLabels = newMarker.getMarkerFieldsHashMap().keySet()
395 .toArray(new String[newMarker.getMarkerFieldsHashMap().size()]);
396
397 tmpType = new LttngEventType(newTracefile.getTracefileName(), newTracefile.getCpuNumber(),
398 newMarker.getName(), newMarkerKey.intValue(), markerFieldsLabels);
399
400 // Add the type to the map/vector
401 addEventTypeToMap(tmpType);
402 }
403 }
404 }
405
406 /*
407 * Add a new type to the HashMap
408 *
cbdacf03
FC
409 * As the hashmap use a key format that is a bit dangerous to use, we should
410 * always add using this function.
12c155f5 411 */
cbdacf03
FC
412 private void addEventTypeToMap(final LttngEventType newEventType) {
413 final int newTypeKey = EventTypeKey.getEventTypeHash(newEventType);
12c155f5
FC
414
415 this.traceTypes.put(newTypeKey, newEventType);
416 this.traceTypeNames.add(newTypeKey);
417 }
418
12c155f5 419 /**
cbdacf03
FC
420 * Return the latest saved location. Note : Modifying the returned location
421 * may result in buggy positionning!
12c155f5
FC
422 *
423 * @return The LttngLocation as it was after the last operation.
424 *
5945cec9 425 * @see org.eclipse.linuxtools.internal.lttng.core.event.LttngLocation
12c155f5
FC
426 */
427 @Override
428 public synchronized ITmfLocation<?> getCurrentLocation() {
429 return previousLocation;
430 }
431
432 /**
433 * Position the trace to the event at the given location.
434 * <p>
cbdacf03
FC
435 * NOTE : Seeking by location is very fast compare to seeking by position
436 * but is still slower than "ReadNext", avoid using it for small interval.
12c155f5 437 *
cbdacf03
FC
438 * @param location Location of the event in the trace. If no event available
439 * at this exact location, we will position ourself to the next
440 * one.
12c155f5
FC
441 *
442 * @return The TmfContext that point to this event
443 *
5945cec9 444 * @see org.eclipse.linuxtools.internal.lttng.core.event.LttngLocation
6c13869b 445 * @see org.eclipse.linuxtools.tmf.core.trace.TmfContext
12c155f5
FC
446 */
447 @Override
07671572 448 public synchronized ITmfContext seekEvent(final ITmfLocation<?> location) {
12c155f5 449
cbdacf03 450 if (PRINT_DEBUG)
12c155f5 451 System.out.println("seekLocation(location) location -> " + location); //$NON-NLS-1$
12c155f5
FC
452
453 // If the location in context is null, create a new one
12c155f5 454 if (location == null) {
07671572
FC
455 LttngLocation curLocation = new LttngLocation();
456 final ITmfContext context = seekEvent(curLocation.getOperationTime());
2352aed9 457 context.setRank(0);
12c155f5 458 return context;
07671572
FC
459 }
460
12c155f5
FC
461 // The only seek valid in LTTng is with the time, we call
462 // seekEvent(timestamp)
07671572
FC
463 LttngLocation curLocation = (LttngLocation) location;
464 final ITmfContext context = seekEvent(curLocation.getOperationTime());
12c155f5 465
655bf113
PT
466 // If the location is marked with the read next flag
467 // then it is pointing to the next event following the operation time
cbdacf03 468 if (curLocation.isLastOperationReadNext())
c32744d6 469 getNext(context);
655bf113 470
12c155f5
FC
471 return context;
472 }
473
474 /**
475 * Position the trace to the event at the given time.
476 * <p>
cbdacf03
FC
477 * NOTE : Seeking by time is very fast compare to seeking by position but is
478 * still slower than "ReadNext", avoid using it for small interval.
12c155f5 479 *
cbdacf03
FC
480 * @param timestamp Time of the event in the trace. If no event available at
481 * this exact time, we will position ourself to the next one.
12c155f5
FC
482 *
483 * @return The TmfContext that point to this event
484 *
5945cec9 485 * @see org.eclipse.linuxtools.internal.lttng.core.event.LttngLocation
6c13869b 486 * @see org.eclipse.linuxtools.tmf.core.trace.TmfContext
12c155f5
FC
487 */
488 @Override
cbdacf03 489 public synchronized TmfContext seekEvent(final ITmfTimestamp timestamp) {
12c155f5 490
cbdacf03 491 if (PRINT_DEBUG)
12c155f5 492 System.out.println("seekEvent(timestamp) timestamp -> " + timestamp); //$NON-NLS-1$
12c155f5
FC
493
494 // Call JNI to seek
495 currentJniTrace.seekToTime(new JniTime(timestamp.getValue()));
496
497 // Save the time at which we seeked
498 previousLocation.setOperationTime(timestamp.getValue());
499 // Set the operation marker as seek, to be able to detect we did "seek"
500 // this event
501 previousLocation.setLastOperationSeek();
502
cbdacf03 503 final LttngLocation curLocation = new LttngLocation(previousLocation);
12c155f5
FC
504
505 return new TmfContext(curLocation);
506 }
507
508 /**
509 * Position the trace to the event at the given position (rank).
510 * <p>
cbdacf03
FC
511 * NOTE : Seeking by position is very slow in LTTng, consider seeking by
512 * timestamp.
12c155f5 513 *
cbdacf03 514 * @param rank Position (or rank) of the event in the trace, starting at 0.
12c155f5
FC
515 *
516 * @return The TmfContext that point to this event
517 *
5945cec9 518 * @see org.eclipse.linuxtools.internal.lttng.core.event.LttngLocation
6c13869b 519 * @see org.eclipse.linuxtools.tmf.core.trace.TmfContext
12c155f5
FC
520 */
521 @Override
cbdacf03 522 public synchronized TmfContext seekEvent(final long rank) {
12c155f5 523
cbdacf03
FC
524 if (PRINT_DEBUG)
525 System.out.println("seekEvent(rank) rank -> " + rank); //$NON-NLS-1$
12c155f5 526
d337369a
FC
527// ITmfTimestamp timestamp = null;
528// long index = rank / getCacheSize();
529//
530// // Get the timestamp of the closest check point to the given position
531// if (fCheckpoints.size() > 0) {
532// if (index >= fCheckpoints.size())
533// index = fCheckpoints.size() - 1;
534// timestamp = fCheckpoints.elementAt((int) index).getTimestamp();
535// } else
536// timestamp = getStartTime();
537
538 // Position the trace at the checkpoint
0316808c 539 final ITmfContext checkpointContext = getIndexer().seekIndex(rank);
d337369a
FC
540 LttngLocation location = (LttngLocation) checkpointContext.getLocation();
541 ITmfTimestamp timestamp = location.getLocation();
20658947 542 long index = rank / getCacheSize();
12c155f5 543
12c155f5 544 // Seek to the found time
cbdacf03 545 final TmfContext tmpContext = seekEvent(timestamp);
0316808c 546 tmpContext.setRank((index + 1) * getCacheSize());
12c155f5
FC
547 previousLocation = (LttngLocation) tmpContext.getLocation();
548
549 // Ajust the index of the event we found at this check point position
20658947 550 Long currentPosition = index * getCacheSize();
12c155f5
FC
551
552 Long lastTimeValueRead = 0L;
553
554 // Get the event at current position. This won't move to the next one
555 JniEvent tmpJniEvent = currentJniTrace.findNextEvent();
556 // Now that we are positionned at the checkpoint,
557 // we need to "readNext" (Position - CheckpointPosition) times or until
558 // trace "run out"
cbdacf03 559 while ((tmpJniEvent != null) && (currentPosition < rank)) {
12c155f5
FC
560 tmpJniEvent = currentJniTrace.readNextEvent();
561 currentPosition++;
562 }
563
564 // If we found our event, save its timestamp
cbdacf03 565 if (tmpJniEvent != null)
12c155f5 566 lastTimeValueRead = tmpJniEvent.getEventTime().getTime();
12c155f5
FC
567
568 // Set the operation marker as seek, to be able to detect we did "seek"
569 // this event
570 previousLocation.setLastOperationSeek();
571 // Save read event time
572 previousLocation.setOperationTime(lastTimeValueRead);
573
574 // *** VERIFY ***
575 // Is that too paranoid?
576 //
577 // We don't trust what upper level could do with our internal location
578 // so we create a new one to return instead
cbdacf03 579 final LttngLocation curLocation = new LttngLocation(previousLocation);
12c155f5 580
cbdacf03 581 return new TmfContext(curLocation, rank);
12c155f5
FC
582 }
583
584 @Override
7e6347b0 585 public TmfContext seekEvent(final double ratio) {
12c155f5
FC
586 // TODO Auto-generated method stub
587 return null;
588 }
589
590 @Override
cbdacf03 591 public double getLocationRatio(final ITmfLocation<?> location) {
12c155f5
FC
592 // TODO Auto-generated method stub
593 return 0;
594 }
595
596 /**
cbdacf03
FC
597 * Return the event in the trace according to the given context. Read it if
598 * necessary.
12c155f5 599 * <p>
cbdacf03
FC
600 * Similar (same?) as ParseEvent except that calling GetNext twice read the
601 * next one the second time.
12c155f5 602 *
cbdacf03 603 * @param context Current TmfContext where to get the event
12c155f5
FC
604 *
605 * @return The LttngEvent we read of null if no event are available
606 *
5945cec9 607 * @see org.eclipse.linuxtools.internal.lttng.core.event.LttngLocation
6c13869b 608 * @see org.eclipse.linuxtools.tmf.core.trace.TmfContext
12c155f5
FC
609 */
610
611 public int nbEventsRead = 0;
612
613 @Override
c32744d6 614 public synchronized LttngEvent getNext(final ITmfContext context) {
12c155f5 615
cbdacf03 616 if (PRINT_DEBUG)
12c155f5
FC
617 System.out.println("getNextEvent(context) context.getLocation() -> " //$NON-NLS-1$
618 + context.getLocation());
12c155f5
FC
619
620 LttngEvent returnedEvent = null;
621 LttngLocation curLocation = null;
622
623 curLocation = (LttngLocation) context.getLocation();
624 // If the location in context is null, create a new one
cbdacf03 625 if (curLocation == null)
12c155f5 626 curLocation = getCurrentLocation(context);
12c155f5 627
12c155f5
FC
628 // *** Positioning trick :
629 // GetNextEvent only read the trace if :
630 // 1- The last operation was NOT a ParseEvent --> A read is required
631 // OR
632 // 2- The time of the previous location is different from the current
633 // one --> A seek + a read is required
634 if ((!(curLocation.isLastOperationParse()))
635 || (previousLocation.getOperationTimeValue() != curLocation.getOperationTimeValue())) {
636 if (previousLocation.getOperationTimeValue() != curLocation.getOperationTimeValue()) {
cbdacf03 637 if (PRINT_DEBUG)
12c155f5
FC
638 System.out.println("\t\tSeeking in getNextEvent. [ LastTime : " //$NON-NLS-1$
639 + previousLocation.getOperationTimeValue() + " CurrentTime" //$NON-NLS-1$
640 + curLocation.getOperationTimeValue() + " ]"); //$NON-NLS-1$
12c155f5
FC
641 seekEvent(curLocation.getOperationTime());
642 }
643 // Read the next event from the trace. The last one will NO LONGER
644 // BE VALID.
645 returnedEvent = readNextEvent(curLocation);
646
647 } else {
648 // No event was read, just return the one currently loaded (the last
649 // one we read)
650 returnedEvent = currentLttngEvent;
651
61d428bd
PT
652 // Set the operation marker as read to both locations, to be able to
653 // detect we need to read the next event
654 previousLocation.setLastOperationReadNext();
655 curLocation.setLastOperationReadNext();
12c155f5
FC
656 }
657
658 // If we read an event, set it's time to the locations (both previous
659 // and current)
cbdacf03 660 if (returnedEvent != null)
12c155f5 661 setPreviousAndCurrentTimes(context, returnedEvent, curLocation);
12c155f5
FC
662
663 return returnedEvent;
664 }
665
666 // this method was extracted for profiling purposes
cbdacf03
FC
667 private synchronized void setPreviousAndCurrentTimes(final ITmfContext context, final LttngEvent returnedEvent,
668 final LttngLocation curLocation) {
12c155f5 669
cbdacf03 670 final ITmfTimestamp eventTimestamp = returnedEvent.getTimestamp();
12c155f5
FC
671 // long eventTime = eventTimestamp.getValue();
672 previousLocation.setOperationTime(eventTimestamp.getValue());
673 curLocation.setOperationTime(eventTimestamp.getValue());
d337369a 674 updateAttributes(context, eventTimestamp);
cbdacf03 675 context.increaseRank();
12c155f5
FC
676 }
677
f17b2f70
FC
678 // protected void updateIndex(TmfContext context, long rank, ITmfTimestamp timestamp) {
679 //
680 // if (getStartTime().compareTo(timestamp, false) > 0)
681 // setStartTime(timestamp);
682 // if (getEndTime().compareTo(timestamp, false) < 0)
683 // setEndTime(timestamp);
684 // if (rank != ITmfContext.UNKNOWN_RANK) {
685 // if (fNbEvents <= rank)
686 // fNbEvents = rank + 1;
687 // // Build the index as we go along
688 // if ((rank % fIndexPageSize) == 0) {
689 // // Determine the table position
690 // long position = rank / fIndexPageSize;
691 // // Add new entry at proper location (if empty)
692 // if (fCheckpoints.size() == position) {
693 // addCheckPoint(context, timestamp);
694 // }
695 // }
696 // }
697 // }
12c155f5
FC
698
699 // this method was extracted for profiling purposes
cbdacf03 700 private synchronized LttngEvent readNextEvent(final LttngLocation curLocation) {
12c155f5
FC
701 LttngEvent returnedEvent;
702 // Read the next event from the trace. The last one will NO LONGER BE
703 // VALID.
704 returnedEvent = readEvent(curLocation);
705 nbEventsRead++;
706
61d428bd
PT
707 // Set the operation marker as read to both locations, to be able to
708 // detect we need to read the next event
12c155f5
FC
709 previousLocation.setLastOperationReadNext();
710 curLocation.setLastOperationReadNext();
711 return returnedEvent;
712 }
713
714 // this method was extracted for profiling purposes
cbdacf03 715 private LttngLocation getCurrentLocation(final ITmfContext context) {
12c155f5
FC
716 LttngLocation curLocation;
717 curLocation = new LttngLocation();
718 context.setLocation(curLocation);
719 return curLocation;
720 }
721
722 /**
cbdacf03
FC
723 * Return the event in the trace according to the given context. Read it if
724 * necessary.
12c155f5 725 * <p>
cbdacf03
FC
726 * Similar (same?) as GetNextEvent except that calling ParseEvent twice will
727 * return the same event
12c155f5 728 *
cbdacf03 729 * @param context Current TmfContext where to get the event
12c155f5
FC
730 *
731 * @return The LttngEvent we read of null if no event are available
732 *
5945cec9 733 * @see org.eclipse.linuxtools.internal.lttng.core.event.LttngLocation
6c13869b 734 * @see org.eclipse.linuxtools.tmf.core.trace.TmfContext
12c155f5
FC
735 */
736 @Override
cbdacf03 737 public synchronized LttngEvent parseEvent(final ITmfContext context) {
12c155f5 738
cbdacf03 739 if (PRINT_DEBUG)
12c155f5
FC
740 System.out.println("parseEvent(context) context.getLocation() -> " //$NON-NLS-1$
741 + context.getLocation());
12c155f5
FC
742
743 LttngEvent returnedEvent = null;
744 LttngLocation curLocation = null;
745
746 // If the location in context is null, create a new one
747 if (context.getLocation() == null) {
748 curLocation = new LttngLocation();
749 context.setLocation(curLocation);
cbdacf03 750 } else
12c155f5 751 curLocation = (LttngLocation) context.getLocation();
12c155f5
FC
752
753 // *** HACK ***
754 // TMF assumes it is possible to read (GetNextEvent) to the next Event
755 // once ParseEvent() is called
756 // In LTTNG, there is not difference between "Parsing" and "Reading" an
757 // event.
758 // So, before "Parsing" an event, we have to make sure we didn't "Read"
759 // it alreafy.
760 // Also, "Reading" invalidate the previous Event in LTTNG and seek back
761 // is very costly,
762 // so calling twice "Parse" will return the same event, giving a way to
763 // get the "Currently loaded" event
764
765 // *** Positionning trick :
766 // ParseEvent only read the trace if :
61d428bd 767 // 1- The last operation was NOT a ParseEvent --> A read is required
12c155f5
FC
768 // OR
769 // 2- The time of the previous location is different from the current
770 // one --> A seek + a read is required
61d428bd 771 if (!curLocation.isLastOperationParse()
12c155f5
FC
772 || (previousLocation.getOperationTimeValue() != curLocation.getOperationTimeValue())) {
773 // Previous time != Current time : We need to reposition to the
774 // current time
775 if (previousLocation.getOperationTimeValue() != curLocation.getOperationTimeValue()) {
cbdacf03 776 if (PRINT_DEBUG)
12c155f5
FC
777 System.out.println("\t\tSeeking in getNextEvent. [ LastTime : " //$NON-NLS-1$
778 + previousLocation.getOperationTimeValue() + " CurrentTime" //$NON-NLS-1$
779 + curLocation.getOperationTimeValue() + " ]"); //$NON-NLS-1$
12c155f5
FC
780 seekEvent(curLocation.getOperationTime());
781 }
782
783 // Read the next event from the trace. The last one will NO LONGER
784 // BE VALID.
785 returnedEvent = readEvent(curLocation);
cbdacf03 786 } else
12c155f5
FC
787 // No event was read, just return the one currently loaded (the last
788 // one we read)
789 returnedEvent = currentLttngEvent;
12c155f5
FC
790
791 // If we read an event, set it's time to the locations (both previous
792 // and current)
793 if (returnedEvent != null) {
794 previousLocation.setOperationTime((LttngTimestamp) returnedEvent.getTimestamp());
795 curLocation.setOperationTime((LttngTimestamp) returnedEvent.getTimestamp());
796 }
797
798 // Set the operation marker as parse to both location, to be able to
799 // detect we already "read" this event
800 previousLocation.setLastOperationParse();
801 curLocation.setLastOperationParse();
802
803 return returnedEvent;
804 }
805
806 /*
807 * Read the next event from the JNI and convert it as Lttng Event<p>
808 *
cbdacf03
FC
809 * @param location Current LttngLocation that to be updated with the event
810 * timestamp
12c155f5
FC
811 *
812 * @return The LttngEvent we read of null if no event are available
813 *
814 * @see org.eclipse.linuxtools.lttng.event.LttngLocation
815 *
816 * @see org.eclipse.linuxtools.org.eclipse.linuxtools.lttng.jni.JniTrace
817 */
cbdacf03 818 private synchronized LttngEvent readEvent(final LttngLocation location) {
12c155f5
FC
819 LttngEvent returnedEvent = null;
820 JniEvent tmpEvent = null;
821
822 // Read the next event from JNI. THIS WILL INVALIDATE THE CURRENT LTTNG
823 // EVENT.
824 tmpEvent = currentJniTrace.readNextEvent();
825
826 if (tmpEvent != null) {
827 // *** NOTE
828 // Convert will update the currentLttngEvent
829 returnedEvent = convertJniEventToTmf(tmpEvent);
830
831 location.setOperationTime((LttngTimestamp) returnedEvent.getTimestamp());
cbdacf03 832 } else
12c155f5 833 location.setOperationTime(getEndTime().getValue() + 1);
12c155f5
FC
834
835 return returnedEvent;
836 }
837
838 /**
839 * Method to convert a JniEvent into a LttngEvent.
840 * <p>
841 *
cbdacf03
FC
842 * Note : This method will call LttngEvent convertEventJniToTmf(JniEvent,
843 * boolean) with a default value for isParsingNeeded
12c155f5 844 *
cbdacf03 845 * @param newEvent The JniEvent to convert into LttngEvent
12c155f5
FC
846 *
847 * @return The converted LttngEvent
848 *
849 * @see org.eclipse.linuxtools.org.eclipse.linuxtools.lttng.jni.JniEvent
5945cec9 850 * @see org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent
12c155f5 851 */
cbdacf03 852 public synchronized LttngEvent convertJniEventToTmf(final JniEvent newEvent) {
12c155f5
FC
853 currentLttngEvent = convertJniEventToTmf(newEvent, IS_PARSING_NEEDED_DEFAULT);
854
855 return currentLttngEvent;
856 }
857
858 /**
859 * Method to convert a JniEvent into a LttngEvent
860 *
cbdacf03
FC
861 * @param jniEvent The JniEvent to convert into LttngEvent
862 * @param isParsingNeeded A boolean value telling if the event should be
863 * parsed or not.
12c155f5
FC
864 *
865 * @return The converted LttngEvent
866 *
867 * @see org.eclipse.linuxtools.org.eclipse.linuxtools.lttng.jni.JniEvent
5945cec9 868 * @see org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent
12c155f5 869 */
cbdacf03 870 public synchronized LttngEvent convertJniEventToTmf(final JniEvent jniEvent, final boolean isParsingNeeded) {
12c155f5 871
212550ba 872 if (UNIQUE_EVENT) {
12c155f5
FC
873
874 // ***
875 // UNHACKED : We can no longer do that because TCF need to maintain
876 // several events at once.
877 // This is very slow to do so in LTTng, this has to be temporary.
878 // *** HACK ***
879 // To save time here, we only set value instead of allocating new
880 // object
881 // This give an HUGE performance improvement
882 // all allocation done in the LttngTrace constructor
883 // ***
884 eventTimestamp.setValue(jniEvent.getEventTime().getTime());
99005796 885 eventSource = jniEvent.requestEventSource();
12c155f5
FC
886
887 eventType = traceTypes.get(EventTypeKey.getEventTypeHash(jniEvent));
888
cbdacf03
FC
889 final String fullTracePath = getName();
890 final String reference = fullTracePath.substring(fullTracePath.lastIndexOf('/') + 1);
4641c2f7 891 currentLttngEvent.setReference(reference);
12c155f5
FC
892
893 eventContent.emptyContent();
894
895 currentLttngEvent.setType(eventType);
896 // Save the jni reference
897 currentLttngEvent.updateJniEventReference(jniEvent);
898
899 // Parse now if was asked
900 // Warning : THIS IS SLOW
cbdacf03 901 if (isParsingNeeded)
12c155f5 902 eventContent.getFields();
12c155f5
FC
903
904 return currentLttngEvent;
cbdacf03 905 } else
12c155f5 906 return convertJniEventToTmfMultipleEventEvilFix(jniEvent, isParsingNeeded);
12c155f5
FC
907
908 }
909
910 /**
cbdacf03
FC
911 * This method is a temporary fix to support multiple events at once in TMF
912 * This is expected to be slow and should be fixed in another way. See
913 * comment in convertJniEventToTmf();
12c155f5 914 *
cbdacf03 915 * @param jniEvent The current JNI Event
12c155f5
FC
916 * @return Current Lttng Event fully parsed
917 */
cbdacf03
FC
918 private synchronized LttngEvent convertJniEventToTmfMultipleEventEvilFix(final JniEvent jniEvent,
919 final boolean isParsingNeeded) {
12c155f5
FC
920 // *** HACK ***
921 // Below : the "fix" with all the new and the full-parse
922 // Allocating new memory is slow.
923 // Parsing every events is very slow.
924 eventTimestamp = new LttngTimestamp(jniEvent.getEventTime().getTime());
99005796 925 eventSource = jniEvent.requestEventSource();
4641c2f7 926 eventReference = getName();
12c155f5
FC
927 eventType = new LttngEventType(traceTypes.get(EventTypeKey.getEventTypeHash(jniEvent)));
928 eventContent = new LttngEventContent(currentLttngEvent);
929 currentLttngEvent = new LttngEvent(this, eventTimestamp, eventSource, eventType, eventContent, eventReference,
930 null);
931
932 // The jni reference is no longer reliable but we will keep it anyhow
933 currentLttngEvent.updateJniEventReference(jniEvent);
934 // Ensure that the content is correctly set
935 eventContent.setEvent(currentLttngEvent);
936
937 // Parse the event if it was needed
938 // *** WARNING ***
939 // ONLY for testing, NOT parsing events with non-unique events WILL
940 // result in segfault in the JVM
cbdacf03 941 if (isParsingNeeded)
12c155f5 942 eventContent.getFields();
12c155f5
FC
943
944 return currentLttngEvent;
945 }
946
947 /**
948 * Reference to the current LttngTrace we are reading from.
949 * <p>
950 *
cbdacf03
FC
951 * Note : This bypass the framework and should not be use, except for
952 * testing!
12c155f5
FC
953 *
954 * @return Reference to the current LttngTrace
955 *
956 * @see org.eclipse.linuxtools.org.eclipse.linuxtools.lttng.jni.JniTrace
957 */
958 public JniTrace getCurrentJniTrace() {
959 return currentJniTrace;
960 }
961
962 /**
963 * Return a reference to the current LttngEvent we have in memory.
964 *
965 * @return The current (last read) LttngEvent
966 *
5945cec9 967 * @see org.eclipse.linuxtools.internal.lttng.core.event.LttngEvent
12c155f5
FC
968 */
969 public synchronized LttngEvent getCurrentEvent() {
970 return currentLttngEvent;
971 }
972
973 /**
974 * Get the major version number for the current trace
975 *
976 * @return Version major or -1 if unknown
977 *
978 * @see org.eclipse.linuxtools.org.eclipse.linuxtools.lttng.jni.JniTrace
979 *
980 */
981 public short getVersionMajor() {
cbdacf03 982 if (currentJniTrace != null)
12c155f5 983 return currentJniTrace.getLttMajorVersion();
cbdacf03 984 else
12c155f5 985 return -1;
12c155f5
FC
986 }
987
988 /**
989 * Get the minor version number for the current trace
990 *
991 * @return Version minor or -1 if unknown
992 *
993 * @see org.eclipse.linuxtools.org.eclipse.linuxtools.lttng.jni.JniTrace
994 *
995 */
996 public short getVersionMinor() {
cbdacf03 997 if (currentJniTrace != null)
12c155f5 998 return currentJniTrace.getLttMinorVersion();
cbdacf03 999 else
12c155f5 1000 return -1;
12c155f5
FC
1001 }
1002
1003 /**
1004 * Get the number of CPU for this trace
1005 *
1006 * @return Number of CPU or -1 if unknown
1007 *
1008 * @see org.eclipse.linuxtools.org.eclipse.linuxtools.lttng.jni.JniTrace
1009 *
1010 */
1011 public int getCpuNumber() {
cbdacf03 1012 if (currentJniTrace != null)
12c155f5 1013 return currentJniTrace.getCpuNumber();
cbdacf03 1014 else
12c155f5 1015 return -1;
12c155f5
FC
1016 }
1017
d337369a
FC
1018// /**
1019// * Print the content of the checkpoint vector.
1020// * <p>
1021// *
1022// * This is intended for debug purpose only.
1023// */
1024// public void printCheckpointsVector() {
1025// System.out.println("StartTime : " //$NON-NLS-1$
1026// + getTimeRange().getStartTime().getValue());
1027// System.out.println("EndTime : " //$NON-NLS-1$
1028// + getTimeRange().getEndTime().getValue());
1029//
1030// for (int pos = 0; pos < fCheckpoints.size(); pos++) {
1031// System.out.print(pos + ": " + "\t"); //$NON-NLS-1$ //$NON-NLS-2$
1032// System.out.print(fCheckpoints.get(pos).getTimestamp() + "\t"); //$NON-NLS-1$
1033// System.out.println(fCheckpoints.get(pos).getLocation());
1034// }
1035// }
12c155f5
FC
1036
1037 @Override
1038 public synchronized void dispose() {
1039 if (currentJniTrace != null)
1040 currentJniTrace.closeTrace();
1041 super.dispose();
1042 }
1043
1044 /**
1045 * Return a String identifying this trace.
1046 *
1047 * @return String that identify this trace
1048 */
1049 @Override
3b38ea61 1050 @SuppressWarnings("nls")
12c155f5
FC
1051 public String toString() {
1052 String returnedData = "";
64fe8e8a 1053
12c155f5
FC
1054 returnedData += "Path :" + getPath() + " ";
1055 returnedData += "Trace:" + currentJniTrace + " ";
1056 returnedData += "Event:" + currentLttngEvent;
64fe8e8a 1057
12c155f5
FC
1058 return returnedData;
1059 }
cb866e08 1060
28b94d61
FC
1061}
1062
1063/*
1064 * EventTypeKey inner class
1065 *
cbdacf03
FC
1066 * This class is used to make the process of generating the HashMap key more
1067 * transparent and so less error prone to use
28b94d61 1068 */
64fe8e8a 1069final class EventTypeKey {
cbdacf03 1070
12c155f5
FC
1071 // *** WARNING ***
1072 // These two getEventTypeKey() functions should ALWAYS construct the key the
1073 // same ways!
1074 // Otherwise, every type search will fail!
64fe8e8a 1075
12c155f5
FC
1076 // added final to encourage inlining.
1077
1078 // generating a hash code by hand to avoid a string creation
cbdacf03 1079 final static public int getEventTypeHash(final LttngEventType newEventType) {
12c155f5
FC
1080 return generateHash(newEventType.getTracefileName(), newEventType.getCpuId(), newEventType.getMarkerName());
1081 }
1082
cbdacf03 1083 final private static int generateHash(final String traceFileName, final long cpuNumber, final String markerName) {
12c155f5
FC
1084 // 0x1337 is a prime number. The number of CPUs is always under 8192 on
1085 // the current kernel, so this will work with the current linux kernel.
cbdacf03 1086 final int cpuHash = (int) (cpuNumber * (0x1337));
12c155f5
FC
1087 return traceFileName.hashCode() ^ (cpuHash) ^ markerName.hashCode();
1088 }
1089
1090 // generating a hash code by hand to avoid a string creation
cbdacf03 1091 final static public int getEventTypeHash(final JniEvent newEvent) {
12c155f5
FC
1092 return generateHash(newEvent.getParentTracefile().getTracefileName(), newEvent.getParentTracefile()
1093 .getCpuNumber(), newEvent.requestEventMarker().getName());
1094 }
64fe8e8a 1095
a3767fd9 1096}
This page took 0.101067 seconds and 5 git commands to generate.