Class TmfEventsCache

java.lang.Object
org.eclipse.tracecompass.tmf.ui.viewers.events.TmfEventsCache

public class TmfEventsCache extends Object
The generic TMF Events table events cache This can help avoid re-reading the trace when the user scrolls a window, for example.
Author:
Patrick Tasse
  • Constructor Details

    • TmfEventsCache

      public TmfEventsCache(int cacheSize, TmfEventsTable table)
      Constructor for the event cache
      Parameters:
      cacheSize - The size of the cache, in number of events
      table - The Events table this cache will cover
  • Method Details

    • setTrace

      public void setTrace(ITmfTrace trace)
      Assign a new trace to this events cache. This clears the current contents.
      Parameters:
      trace - The trace to assign.
    • clear

      public void clear()
      Clear the current contents of this cache.
    • applyFilter

      public void applyFilter(ITmfFilter filter, boolean collapseFilterEnabled)
      Apply a filter on this event cache. This clears the current cache contents.
      Parameters:
      filter - The ITmfFilter to apply.
      collapseFilterEnabled - true if the collapse filter is enabled
      Since:
      2.0
    • clearFilter

      public void clearFilter()
      Clear the current filter on this cache. This also clears the current cache contents.
    • getEvent

      public TmfEventsCache.CachedEvent getEvent(int index)
      Get an event from the cache. If the cache does not contain the event, a cache population request is triggered.
      Parameters:
      index - The index of this event in the cache
      Returns:
      The cached event, or 'null' if the event is not in the cache
    • peekEvent

      public TmfEventsCache.CachedEvent peekEvent(int index)
      Peek an event in the cache. Does not trigger cache population.
      Parameters:
      index - Index of the event to peek
      Returns:
      The cached event, or 'null' if the event is not in the cache
    • storeEvent

      public void storeEvent(ITmfEvent event, long rank, int index)
      Add a trace event to the cache.
      Parameters:
      event - The original trace event to be cached
      rank - The rank of this event in the trace
      index - The index this event will occupy in the cache
    • updateCollapsedEvent

      public void updateCollapsedEvent(int index)
      Update event repeat count at index
      Parameters:
      index - The index this event occupies in the cache
    • getFilteredEventIndex

      public int getFilteredEventIndex(long rank)
      Get the cache index of an event from his rank in the trace. This will take in consideration any filter that might be applied.
      Parameters:
      rank - The rank of the event in the trace
      Returns:
      The position (index) this event should use once cached