Bug 1628073 - Document some of the symbolication python code; r=sparky,perftest-reviewers
authorGreg Tatum <gtatum@mozilla.com>
Fri, 22 May 2020 13:17:55 +0000
changeset 531613 3223007370b6abf6ffe9848a3496d75a3dd6b0fc
parent 531612 ed24048652900853d41d71698a4f92f45cc240f3
child 531614 bfb980a9199bb85e8b95bc064ed1e25e488b6af9
push id37441
push userapavel@mozilla.com
push dateFri, 22 May 2020 21:38:53 +0000
treeherdermozilla-central@d6abd35b54ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssparky, perftest-reviewers
bugs1628073
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1628073 - Document some of the symbolication python code; r=sparky,perftest-reviewers Differential Revision: https://phabricator.services.mozilla.com/D74287
testing/talos/talos/profiler/symFileManager.py
testing/talos/talos/profiler/symbolication.py
--- a/testing/talos/talos/profiler/symFileManager.py
+++ b/testing/talos/talos/profiler/symFileManager.py
@@ -33,17 +33,33 @@ class SymbolInfo:
 
     def GetEntryCount(self):
         return self.entryCount
 
 # Singleton for .sym / .nmsym file cache management
 
 
 class SymFileManager:
-    # Symbol cache data structures
+    """This class fetches symbols from files and caches the results.
+
+    options (obj)
+        symbolPaths : dictionary
+            Paths to .SYM files, expressed internally as a mapping of app or platform
+            names to directories. App & OS names from requests are converted to
+            all-uppercase internally
+            e.g. { "FIREFOX": "/tmp/path" }
+        maxCacheEntries : number
+            Maximum number of symbol files to keep in memory
+        prefetchInterval : number
+            Frequency of checking for recent symbols to cache (in hours)
+        prefetchThreshold : number
+            Oldest file age to prefetch (in hours)
+        prefetchMaxSymbolsPerLib : (number)
+            Maximum number of library versions to pre-fetch per library
+    """
     sCache = {}
     sCacheCount = 0
     sCacheLock = threading.Lock()
     sMruSymbols = []
 
     sOptions = {}
     sCallbackTimer = None
 
@@ -177,16 +193,17 @@ class SymFileManager:
             str(len(symbolMap.keys())) + " unique entries from "
         logString += str(publicCount) + " PUBLIC lines, " + \
             str(funcCount) + " FUNC lines"
         LogTrace(logString)
 
         return SymbolInfo(symbolMap)
 
     def PrefetchRecentSymbolFiles(self):
+        """This method runs in a loop. Use the options "prefetchThreshold" to adjust"""
         global PREFETCHED_LIBS
 
         LogMessage("Prefetching recent symbol files")
         # Schedule next timer callback
         interval = self.sOptions['prefetchInterval'] * 60 * 60
         self.sCallbackTimer = threading.Timer(
             interval, self.PrefetchRecentSymbolFiles)
         self.sCallbackTimer.start()
--- a/testing/talos/talos/profiler/symbolication.py
+++ b/testing/talos/talos/profiler/symbolication.py
@@ -118,16 +118,24 @@ class LinuxSymbolDumper:
                                     stderr=subprocess.PIPE)
             stdout, stderr = proc.communicate()
             if proc.returncode == 0:
                 f.write(stdout)
         return output_filename
 
 
 class ProfileSymbolicator:
+    """This class orchestrates symbolication for a Gecko profile.
+
+    It can be used by multiple pieces of testing infrastructure that generate Gecko
+    performance profiles.
+
+    Args:
+        options (obj): See SymFileManager for details on these options.
+    """
 
     def __init__(self, options):
         self.options = options
         self.sym_file_manager = SymFileManager(self.options)
         self.symbol_dumper = self.get_symbol_dumper()
 
     def get_symbol_dumper(self):
         try: