Class Storage


  • public final class Storage
    extends java.lang.Object
    Storage is responsible for storing and returning recorded marks. This is a low level class and not intended for use by users. Instead, the TraceEventWriter and TraceEventViewer classes provide easier to use APIs for accessing PerfMark data.

    This code is NOT API stable, and may be removed in the future, or changed without notice.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.concurrent.ConcurrentMap<java.lang.Object,​java.lang.ref.Reference<MarkHolder>> allMarkHolders  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Storage()  
    • Field Detail

      • allMarkHolders

        private static final java.util.concurrent.ConcurrentMap<java.lang.Object,​java.lang.ref.Reference<MarkHolder>> allMarkHolders
    • Constructor Detail

      • Storage

        private Storage()
    • Method Detail

      • getInitNanoTime

        public static long getInitNanoTime()
      • read

        public static java.util.List<MarkList> read()
        Returns a list of MarkLists across all reachable threads. MarkLists with no Marks may be removed.
        Returns:
        all reachable MarkLists.
      • resetForThread

        public static void resetForThread()
        Removes all data for the calling Thread. Other threads may Still have stored data.
      • resetForAll

        public static void resetForAll()
        Removes the global Read index on all storage, but leaves local storage in place. Because writer threads may still be writing to the same buffer (which they have a strong ref to), this function only removed data that is truly unwritable anymore. In addition, it captures a timestamp to which marks to include when reading. Thus, the data isn't fully removed. To fully remove all data, each tracing thread must call resetForThread().
      • registerMarkHolder

        public static void registerMarkHolder​(MarkHolder markHolder)
        Note: it is the responsibility of the caller to keep a strong reference to the markHolder.
      • unregisterMarkHolder

        public static void unregisterMarkHolder​(MarkHolder markHolder)
        This method is meant to aid in cleanup. It is not efficient so don't use it in production.
      • readForTest

        public static MarkList readForTest()
        May Return null.