1 /*******************************************************************************
2 * Copyright (c) 2009, 2013 Ericsson, École Polytechnique de Montréal
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
10 * Francois Chouinard - Initial API and implementation
11 * Francois Chouinard - Updated as per TMF Trace Model 1.0
12 * Patrick Tasse - Updated for removal of context clone
13 * Geneviève Bastien - Added timestamp transforms, its saving to file and
14 * timestamp creation functions
15 *******************************************************************************/
17 package org
.eclipse
.linuxtools
.tmf
.core
.trace
;
20 import java
.io
.FileInputStream
;
21 import java
.io
.FileOutputStream
;
22 import java
.io
.IOException
;
23 import java
.io
.ObjectInputStream
;
24 import java
.io
.ObjectOutputStream
;
25 import java
.util
.Collections
;
26 import java
.util
.HashMap
;
27 import java
.util
.LinkedHashMap
;
29 import java
.util
.Map
.Entry
;
31 import org
.eclipse
.core
.resources
.IFolder
;
32 import org
.eclipse
.core
.resources
.IProject
;
33 import org
.eclipse
.core
.resources
.IResource
;
34 import org
.eclipse
.core
.runtime
.CoreException
;
35 import org
.eclipse
.core
.runtime
.IStatus
;
36 import org
.eclipse
.core
.runtime
.MultiStatus
;
37 import org
.eclipse
.core
.runtime
.Path
;
38 import org
.eclipse
.core
.runtime
.Status
;
39 import org
.eclipse
.linuxtools
.internal
.tmf
.core
.Activator
;
40 import org
.eclipse
.linuxtools
.tmf
.core
.TmfCommonConstants
;
41 import org
.eclipse
.linuxtools
.tmf
.core
.analysis
.IAnalysisModule
;
42 import org
.eclipse
.linuxtools
.tmf
.core
.analysis
.IAnalysisModuleHelper
;
43 import org
.eclipse
.linuxtools
.tmf
.core
.analysis
.TmfAnalysisManager
;
44 import org
.eclipse
.linuxtools
.tmf
.core
.component
.TmfEventProvider
;
45 import org
.eclipse
.linuxtools
.tmf
.core
.event
.ITmfEvent
;
46 import org
.eclipse
.linuxtools
.tmf
.core
.exceptions
.TmfAnalysisException
;
47 import org
.eclipse
.linuxtools
.tmf
.core
.exceptions
.TmfTraceException
;
48 import org
.eclipse
.linuxtools
.tmf
.core
.request
.ITmfEventRequest
;
49 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfSignalHandler
;
50 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfSignalManager
;
51 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfTraceOpenedSignal
;
52 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfTraceRangeUpdatedSignal
;
53 import org
.eclipse
.linuxtools
.tmf
.core
.signal
.TmfTraceUpdatedSignal
;
54 import org
.eclipse
.linuxtools
.tmf
.core
.statesystem
.ITmfStateSystem
;
55 import org
.eclipse
.linuxtools
.tmf
.core
.statistics
.ITmfStatistics
;
56 import org
.eclipse
.linuxtools
.tmf
.core
.statistics
.TmfStateStatistics
;
57 import org
.eclipse
.linuxtools
.tmf
.core
.synchronization
.ITmfTimestampTransform
;
58 import org
.eclipse
.linuxtools
.tmf
.core
.synchronization
.TmfTimestampTransform
;
59 import org
.eclipse
.linuxtools
.tmf
.core
.timestamp
.ITmfTimestamp
;
60 import org
.eclipse
.linuxtools
.tmf
.core
.timestamp
.TmfTimeRange
;
61 import org
.eclipse
.linuxtools
.tmf
.core
.timestamp
.TmfTimestamp
;
62 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.indexer
.ITmfTraceIndexer
;
63 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.indexer
.checkpoint
.TmfCheckpointIndexer
;
64 import org
.eclipse
.linuxtools
.tmf
.core
.trace
.location
.ITmfLocation
;
67 * Abstract implementation of ITmfTrace.
69 * Since the concept of 'location' is trace specific, the concrete classes have
70 * to provide the related methods, namely:
72 * <li> public ITmfLocation<?> getCurrentLocation()
73 * <li> public double getLocationRatio(ITmfLocation<?> location)
74 * <li> public ITmfContext seekEvent(ITmfLocation<?> location)
75 * <li> public ITmfContext seekEvent(double ratio)
76 * <li> public IStatus validate(IProject project, String path)
78 * A concrete trace must provide its corresponding parser. A common way to
79 * accomplish this is by making the concrete class extend TmfTrace and
80 * implement ITmfEventParser.
82 * The concrete class can either specify its own indexer or use the provided
83 * TmfCheckpointIndexer (default). In this case, the trace cache size will be
84 * used as checkpoint interval.
87 * @author Francois Chouinard
90 * @see ITmfTraceIndexer
91 * @see ITmfEventParser
93 public abstract class TmfTrace
extends TmfEventProvider
implements ITmfTrace
{
95 // ------------------------------------------------------------------------
97 // ------------------------------------------------------------------------
99 // The resource used for persistent properties for this trace
100 private IResource fResource
;
103 private String fPath
;
105 // The trace cache page size
106 private int fCacheSize
= ITmfTrace
.DEFAULT_TRACE_CACHE_SIZE
;
108 // The number of events collected (so far)
109 private long fNbEvents
= 0;
111 // The time span of the event stream
112 private ITmfTimestamp fStartTime
= TmfTimestamp
.BIG_BANG
;
113 private ITmfTimestamp fEndTime
= TmfTimestamp
.BIG_BANG
;
115 // The trace streaming interval (0 = no streaming)
116 private long fStreamingInterval
= 0;
119 private ITmfTraceIndexer fIndexer
;
122 private ITmfEventParser fParser
;
124 // The trace's statistics
125 private ITmfStatistics fStatistics
;
128 * The collection of state systems that are registered with this trace. Each
129 * sub-class can decide to add its (one or many) state system to this map
130 * during their {@link #buildStateSystem()}.
134 protected final Map
<String
, ITmfStateSystem
> fStateSystems
=
135 new LinkedHashMap
<>();
137 private ITmfTimestampTransform fTsTransform
;
139 private final Map
<String
, IAnalysisModule
> fAnalysisModules
=
140 new LinkedHashMap
<>();
142 private static final String SYNCHRONIZATION_FORMULA_FILE
= "sync_formula"; //$NON-NLS-1$
144 // ------------------------------------------------------------------------
146 // ------------------------------------------------------------------------
149 * The default, parameterless, constructor
153 fIndexer
= createIndexer(DEFAULT_BLOCK_SIZE
);
160 * The resource associated to the trace
162 * The type of events that will be read from this trace
164 * The path to the trace on the filesystem
166 * The trace cache size. Pass '-1' to use the default specified
167 * in {@link ITmfTrace#DEFAULT_TRACE_CACHE_SIZE}
169 * The trace streaming interval. You can use '0' for post-mortem
172 * The trace event parser. Use 'null' if (and only if) the trace
173 * object itself is also the ITmfEventParser to be used.
174 * @throws TmfTraceException
175 * If something failed during the opening
177 protected TmfTrace(final IResource resource
,
178 final Class
<?
extends ITmfEvent
> type
,
182 final ITmfEventParser parser
)
183 throws TmfTraceException
{
185 fCacheSize
= (cacheSize
> 0) ? cacheSize
: ITmfTrace
.DEFAULT_TRACE_CACHE_SIZE
;
186 fStreamingInterval
= interval
;
188 initialize(resource
, path
, type
);
194 * @param trace the original trace
195 * @throws TmfTraceException Should not happen usually
197 public TmfTrace(final TmfTrace trace
) throws TmfTraceException
{
200 throw new IllegalArgumentException();
202 fCacheSize
= trace
.getCacheSize();
203 fStreamingInterval
= trace
.getStreamingInterval();
204 fParser
= trace
.fParser
;
205 initialize(trace
.getResource(), trace
.getPath(), trace
.getEventType());
209 * Creates the indexer instance. Classes extending this class can override
210 * this to provide a different indexer implementation.
212 * @param interval the checkpoints interval
214 * @return the indexer
217 protected ITmfTraceIndexer
createIndexer(int interval
) {
218 return new TmfCheckpointIndexer(this, interval
);
221 // ------------------------------------------------------------------------
222 // ITmfTrace - Initializers
223 // ------------------------------------------------------------------------
226 public void initTrace(final IResource resource
, final String path
, final Class
<?
extends ITmfEvent
> type
) throws TmfTraceException
{
227 initialize(resource
, path
, type
);
231 * Initialize the trace common attributes and the base component.
233 * @param resource the Eclipse resource (trace)
234 * @param path the trace path
235 * @param type the trace event type
237 * @throws TmfTraceException If something failed during the initialization
239 protected void initialize(final IResource resource
,
241 final Class
<?
extends ITmfEvent
> type
)
242 throws TmfTraceException
{
244 throw new TmfTraceException("Invalid trace path"); //$NON-NLS-1$
247 fResource
= resource
;
248 String traceName
= (resource
!= null) ? resource
.getName() : null;
249 // If no resource was provided, extract the display name the trace path
250 if (traceName
== null) {
251 traceName
= new Path(path
).lastSegment();
253 if (fParser
== null) {
254 if (this instanceof ITmfEventParser
) {
255 fParser
= (ITmfEventParser
) this;
257 throw new TmfTraceException("Invalid trace parser"); //$NON-NLS-1$
260 super.init(traceName
, type
);
261 // register as VIP after super.init() because TmfComponent registers to signal manager there
262 TmfSignalManager
.registerVIP(this);
263 fIndexer
= createIndexer(fCacheSize
);
267 * Indicates if the path points to an existing file/directory
269 * @param path the path to test
270 * @return true if the file/directory exists
272 protected boolean fileExists(final String path
) {
273 final File file
= new File(path
);
274 return file
.exists();
281 public void indexTrace(boolean waitForCompletion
) {
282 getIndexer().buildIndex(0, TmfTimeRange
.ETERNITY
, waitForCompletion
);
286 * The default implementation of TmfTrace uses a TmfStatistics back-end.
287 * Override this if you want to specify another type (or none at all).
289 * @return An IStatus indicating if the statistics could be built
290 * successfully or not.
293 protected IStatus
buildStatistics() {
295 * Initialize the statistics provider, but only if a Resource has been
296 * set (so we don't build it for experiments, for unit tests, etc.)
299 fStatistics
= (fResource
== null ?
null : new TmfStateStatistics(this) );
300 } catch (TmfTraceException e
) {
301 return new Status(IStatus
.ERROR
, Activator
.PLUGIN_ID
, e
.getMessage(), e
);
303 return Status
.OK_STATUS
;
307 * Build the state system(s) associated with this trace type.
309 * @return An IStatus indicating if the state system could be build
310 * successfully or not.
314 protected IStatus
buildStateSystem() {
316 * Nothing is done in the base implementation, please specify
317 * how/if to register a new state system in derived classes.
319 return Status
.OK_STATUS
;
323 * Instantiate the applicable analysis modules and executes the analysis
324 * modules that are meant to be automatically executed
326 * @return An IStatus indicating whether the analysis could be run
327 * successfully or not
330 protected IStatus
executeAnalysis() {
331 MultiStatus status
= new MultiStatus(Activator
.PLUGIN_ID
, IStatus
.OK
, null, null);
332 Map
<String
, IAnalysisModuleHelper
> modules
= TmfAnalysisManager
.getAnalysisModules(this.getClass());
333 for (IAnalysisModuleHelper helper
: modules
.values()) {
335 IAnalysisModule module
= helper
.newModule(this);
336 fAnalysisModules
.put(module
.getId(), module
);
337 if (module
.isAutomatic()) {
338 status
.add(module
.schedule());
340 } catch (TmfAnalysisException e
) {
341 status
.add(new Status(IStatus
.ERROR
, Activator
.PLUGIN_ID
, e
.getMessage(), e
));
351 public final IAnalysisModule
getAnalysisModule(String analysisId
) {
352 return fAnalysisModules
.get(analysisId
);
359 public <T
> Map
<String
, T
> getAnalysisModules(Class
<T
> moduleclass
) {
360 Map
<String
, T
> modules
= new HashMap
<>();
361 for (Entry
<String
, IAnalysisModule
> entry
: fAnalysisModules
.entrySet()) {
362 if (moduleclass
.isAssignableFrom(entry
.getValue().getClass())) {
363 modules
.put(entry
.getKey(), moduleclass
.cast(entry
.getValue()));
373 public Map
<String
, IAnalysisModule
> getAnalysisModules() {
374 return Collections
.unmodifiableMap(fAnalysisModules
);
381 public synchronized void dispose() {
382 /* Clean up the index if applicable */
383 if (getIndexer() != null) {
384 getIndexer().dispose();
387 /* Clean up the statistics */
388 if (fStatistics
!= null) {
389 fStatistics
.dispose();
392 /* Clean up the state systems */
393 for (ITmfStateSystem ss
: fStateSystems
.values()) {
400 // ------------------------------------------------------------------------
401 // ITmfTrace - Basic getters
402 // ------------------------------------------------------------------------
405 public Class
<?
extends ITmfEvent
> getEventType() {
406 return super.getType();
410 public IResource
getResource() {
415 public String
getPath() {
420 public int getCacheSize() {
425 public long getStreamingInterval() {
426 return fStreamingInterval
;
430 * @return the trace indexer
433 protected ITmfTraceIndexer
getIndexer() {
438 * @return the trace parser
440 protected ITmfEventParser
getParser() {
448 public ITmfStatistics
getStatistics() {
454 * @deprecated See {@link ITmfTrace}
458 public final Map
<String
, ITmfStateSystem
> getStateSystems() {
459 return Collections
.unmodifiableMap(fStateSystems
);
464 * @deprecated See {@link ITmfTrace}
468 public final void registerStateSystem(String id
, ITmfStateSystem ss
) {
469 fStateSystems
.put(id
, ss
);
472 // ------------------------------------------------------------------------
473 // ITmfTrace - Trace characteristics getters
474 // ------------------------------------------------------------------------
477 public synchronized long getNbEvents() {
485 public TmfTimeRange
getTimeRange() {
486 return new TmfTimeRange(fStartTime
, fEndTime
);
493 public ITmfTimestamp
getStartTime() {
501 public ITmfTimestamp
getEndTime() {
509 public ITmfTimestamp
getInitialRangeOffset() {
510 final long DEFAULT_INITIAL_OFFSET_VALUE
= (1L * 100 * 1000 * 1000); // .1sec
511 return new TmfTimestamp(DEFAULT_INITIAL_OFFSET_VALUE
, ITmfTimestamp
.NANOSECOND_SCALE
);
518 public String
getHostId() {
519 return this.getName();
522 // ------------------------------------------------------------------------
523 // Convenience setters
524 // ------------------------------------------------------------------------
527 * Set the trace cache size. Must be done at initialization time.
529 * @param cacheSize The trace cache size
531 protected void setCacheSize(final int cacheSize
) {
532 fCacheSize
= cacheSize
;
536 * Set the trace known number of events. This can be quite dynamic
537 * during indexing or for live traces.
539 * @param nbEvents The number of events
541 protected synchronized void setNbEvents(final long nbEvents
) {
542 fNbEvents
= (nbEvents
> 0) ? nbEvents
: 0;
546 * Update the trace events time range
548 * @param range the new time range
551 protected void setTimeRange(final TmfTimeRange range
) {
552 fStartTime
= range
.getStartTime();
553 fEndTime
= range
.getEndTime();
557 * Update the trace chronologically first event timestamp
559 * @param startTime the new first event timestamp
562 protected void setStartTime(final ITmfTimestamp startTime
) {
563 fStartTime
= startTime
;
567 * Update the trace chronologically last event timestamp
569 * @param endTime the new last event timestamp
572 protected void setEndTime(final ITmfTimestamp endTime
) {
577 * Set the polling interval for live traces (default = 0 = no streaming).
579 * @param interval the new trace streaming interval
581 protected void setStreamingInterval(final long interval
) {
582 fStreamingInterval
= (interval
> 0) ? interval
: 0;
586 * Set the trace parser. Must be done at initialization time.
588 * @param parser the new trace parser
590 protected void setParser(final ITmfEventParser parser
) {
594 // ------------------------------------------------------------------------
595 // ITmfTrace - SeekEvent operations (returning a trace context)
596 // ------------------------------------------------------------------------
599 public synchronized ITmfContext
seekEvent(final long rank
) {
601 // A rank <= 0 indicates to seek the first event
603 ITmfContext context
= seekEvent((ITmfLocation
) null);
608 // Position the trace at the checkpoint
609 final ITmfContext context
= fIndexer
.seekIndex(rank
);
611 // And locate the requested event context
612 long pos
= context
.getRank();
614 ITmfEvent event
= getNext(context
);
615 while ((event
!= null) && (++pos
< rank
)) {
616 event
= getNext(context
);
626 public synchronized ITmfContext
seekEvent(final ITmfTimestamp timestamp
) {
628 // A null timestamp indicates to seek the first event
629 if (timestamp
== null) {
630 ITmfContext context
= seekEvent((ITmfLocation
) null);
635 // Position the trace at the checkpoint
636 ITmfContext context
= fIndexer
.seekIndex(timestamp
);
638 // And locate the requested event context
639 ITmfLocation previousLocation
= context
.getLocation();
640 long previousRank
= context
.getRank();
641 ITmfEvent event
= getNext(context
);
642 while (event
!= null && event
.getTimestamp().compareTo(timestamp
, false) < 0) {
643 previousLocation
= context
.getLocation();
644 previousRank
= context
.getRank();
645 event
= getNext(context
);
648 context
.setLocation(null);
649 context
.setRank(ITmfContext
.UNKNOWN_RANK
);
652 context
= seekEvent(previousLocation
);
653 context
.setRank(previousRank
);
658 // ------------------------------------------------------------------------
659 // ITmfTrace - Read operations (returning an actual event)
660 // ------------------------------------------------------------------------
663 public synchronized ITmfEvent
getNext(final ITmfContext context
) {
664 // parseEvent() does not update the context
665 final ITmfEvent event
= fParser
.parseEvent(context
);
667 updateAttributes(context
, event
.getTimestamp());
668 context
.setLocation(getCurrentLocation());
669 context
.increaseRank();
676 * Hook for special event processing by the concrete class
677 * (called by TmfTrace.getEvent())
679 * @param event the event
681 protected void processEvent(final ITmfEvent event
) {
686 * Update the trace attributes
688 * @param context the current trace context
689 * @param timestamp the corresponding timestamp
692 protected synchronized void updateAttributes(final ITmfContext context
, final ITmfTimestamp timestamp
) {
693 if (fStartTime
.equals(TmfTimestamp
.BIG_BANG
) || (fStartTime
.compareTo(timestamp
, false) > 0)) {
694 fStartTime
= timestamp
;
696 if (fEndTime
.equals(TmfTimestamp
.BIG_CRUNCH
) || (fEndTime
.compareTo(timestamp
, false) < 0)) {
697 fEndTime
= timestamp
;
699 if (context
.hasValidRank()) {
700 long rank
= context
.getRank();
701 if (fNbEvents
<= rank
) {
702 fNbEvents
= rank
+ 1;
704 if (fIndexer
!= null) {
705 fIndexer
.updateIndex(context
, timestamp
);
710 // ------------------------------------------------------------------------
712 // ------------------------------------------------------------------------
718 public synchronized ITmfContext
armRequest(final ITmfEventRequest request
) {
719 if (executorIsShutdown()) {
722 if (!TmfTimestamp
.BIG_BANG
.equals(request
.getRange().getStartTime())
723 && (request
.getIndex() == 0)) {
724 final ITmfContext context
= seekEvent(request
.getRange().getStartTime());
725 request
.setStartIndex((int) context
.getRank());
729 return seekEvent(request
.getIndex());
732 // ------------------------------------------------------------------------
734 // ------------------------------------------------------------------------
737 * Handler for the Trace Opened signal
740 * The incoming signal
744 public void traceOpened(TmfTraceOpenedSignal signal
) {
745 boolean signalIsForUs
= false;
746 for (ITmfTrace trace
: TmfTraceManager
.getTraceSet(signal
.getTrace())) {
748 signalIsForUs
= true;
753 if (!signalIsForUs
) {
758 * The signal is either for this trace, or for an experiment containing
761 MultiStatus status
= new MultiStatus(Activator
.PLUGIN_ID
, IStatus
.OK
, null, null);
762 status
.add(buildStatistics());
763 status
.add(buildStateSystem());
764 status
.add(executeAnalysis());
765 if (!status
.isOK()) {
766 Activator
.log(status
);
769 refreshSupplementaryFiles();
771 if (signal
.getTrace() == this) {
772 /* Additionally, the signal is directly for this trace. */
773 if (getNbEvents() == 0) {
777 /* For a streaming trace, the range updated signal should be sent
778 * by the subclass when a new safe time is determined.
780 if (getStreamingInterval() > 0) {
784 final TmfTimeRange timeRange
= new TmfTimeRange(getStartTime(), TmfTimestamp
.BIG_CRUNCH
);
785 final TmfTraceRangeUpdatedSignal rangeUpdatedsignal
= new TmfTraceRangeUpdatedSignal(this, this, timeRange
);
787 // Broadcast in separate thread to prevent deadlock
791 broadcast(rangeUpdatedsignal
);
799 * Refresh the supplementary files resources, so it can pick up new files
803 public void refreshSupplementaryFiles() {
804 if (fResource
!= null) {
805 IProject project
= fResource
.getProject();
806 IFolder supplFolder
= project
.getFolder(TmfCommonConstants
.TRACE_SUPPLEMENATARY_FOLDER_NAME
);
807 if (supplFolder
.exists()) {
809 supplFolder
.refreshLocal(IResource
.DEPTH_INFINITE
, null);
810 } catch (CoreException e
) {
811 Activator
.logError("Error refreshing resources", e
); //$NON-NLS-1$
818 * Signal handler for the TmfTraceRangeUpdatedSignal signal
820 * @param signal The incoming signal
824 public void traceRangeUpdated(final TmfTraceRangeUpdatedSignal signal
) {
825 if (signal
.getTrace() == this) {
826 getIndexer().buildIndex(getNbEvents(), signal
.getRange(), false);
831 * Signal handler for the TmfTraceUpdatedSignal signal
833 * @param signal The incoming signal
837 public void traceUpdated(final TmfTraceUpdatedSignal signal
) {
838 if (signal
.getSource() == getIndexer()) {
839 fNbEvents
= signal
.getNbEvents();
840 fStartTime
= signal
.getRange().getStartTime();
841 fEndTime
= signal
.getRange().getEndTime();
846 * Returns the file resource used to store synchronization formula. The file
849 * @return the synchronization file
851 private File
getSyncFormulaFile() {
853 if (fResource
instanceof IFolder
) {
855 String supplDirectory
;
857 supplDirectory
= fResource
.getPersistentProperty(TmfCommonConstants
.TRACE_SUPPLEMENTARY_FOLDER
);
859 file
= new File(supplDirectory
+ File
.separator
+ SYNCHRONIZATION_FORMULA_FILE
);
861 } catch (CoreException e
) {
868 // ------------------------------------------------------------------------
869 // Timestamp transformation functions
870 // ------------------------------------------------------------------------
876 public ITmfTimestampTransform
getTimestampTransform() {
877 if (fTsTransform
== null) {
878 /* Check if a formula is stored somewhere in the resources */
879 File sync_file
= getSyncFormulaFile();
880 if (sync_file
!= null && sync_file
.exists()) {
882 try (FileInputStream fis
= new FileInputStream(sync_file
);
883 ObjectInputStream ois
= new ObjectInputStream(fis
);) {
885 fTsTransform
= (ITmfTimestampTransform
) ois
.readObject();
887 } catch (ClassNotFoundException
| IOException e
) {
888 fTsTransform
= TmfTimestampTransform
.IDENTITY
;
891 fTsTransform
= TmfTimestampTransform
.IDENTITY
;
901 public void setTimestampTransform(final ITmfTimestampTransform tt
) {
904 /* Save the timestamp transform to a file */
905 File sync_file
= getSyncFormulaFile();
906 if (sync_file
!= null) {
907 if (sync_file
.exists()) {
910 FileOutputStream fos
;
911 ObjectOutputStream oos
;
913 /* Save the header of the file */
915 fos
= new FileOutputStream(sync_file
, false);
916 oos
= new ObjectOutputStream(fos
);
918 oos
.writeObject(fTsTransform
);
921 } catch (IOException e1
) {
922 Activator
.logError("Error writing timestamp transform for trace", e1
); //$NON-NLS-1$
931 public ITmfTimestamp
createTimestamp(long ts
) {
932 return new TmfTimestamp(getTimestampTransform().transform(ts
));
935 // ------------------------------------------------------------------------
937 // ------------------------------------------------------------------------
940 @SuppressWarnings("nls")
941 public synchronized String
toString() {
942 return "TmfTrace [fPath=" + fPath
+ ", fCacheSize=" + fCacheSize
943 + ", fNbEvents=" + fNbEvents
+ ", fStartTime=" + fStartTime
944 + ", fEndTime=" + fEndTime
+ ", fStreamingInterval=" + fStreamingInterval
+ "]";