def report(profileInfoPath, runId=None, dataSourcePath=None, benchmarkPath=None, cprofile=None, profileName=None, verbose=None): """ Generates report for a previous profiling runs :param profileInfoPath: Path to profile info module :type profileInfoPath: str :param runId: Unique identifier for a previous run :type runId: str :param dataSourcePath: Path to load txn data for reporting :param benchmarkPath: Path to persist profile data for benchmarking :type benchmarkPath: str :param cprofile: Handle to capture self profile Xpedite report generation code (Default value = None) :type cprofile: C{xpedite.selfProfile.CProfile} :param profileName: Name of the profile report :type profileName: str :param verbose: Flag to enable, verbose logging :type verbose: bool """ if verbose: enableVerboseLogging() profileInfo = loadProfileInfo(profileInfoPath) validateBenchmarkPath(benchmarkPath) app = XpediteDormantApp(profileInfo.appName, profileInfo.appHost, profileInfo.appInfo, runId=runId, dataSourcePath=dataSourcePath) with app: reportName = buildReportName(profileInfo.appName, profileName) report = Profiler.profile(app, profileInfo, reportName, benchmarkPath, True, cprofile=cprofile) return profileInfo, report
def record(profileInfoPath, benchmarkPath=None, duration=None, heartbeatInterval=None, samplesFileSize=None, cprofile=None, profileName=None, verbose=None): """ Records an xpedite profile using the supplied parameters :param profileInfoPath: Path to profile info module :type profileInfoPath: str :param benchmarkPath: Path to persist profile data for benchmarking :type benchmarkPath: str :param duration: Profile duration - The session is automatically terminated after elapse of duration seconds (Default value = None) :type duration: int :param heartbeatInterval: Heartbeat interval for profiler's tcp connection :type heartbeatInterval: int :param samplesFileSize: Max size of data files used to store samples :type samplesFileSize: int :param cprofile: Handle to capture self profile Xpedite report generation code (Default value = None) :type cprofile: C{xpedite.selfProfile.CProfile} :param profileName: Name of the profile report :type profileName: str :param verbose: Flag to enable, verbose logging :type verbose: bool """ if verbose: enableVerboseLogging() profileInfo = loadProfileInfo(profileInfoPath) validateBenchmarkPath(benchmarkPath) app = XpediteApp(profileInfo.appName, profileInfo.appHost, profileInfo.appInfo) with app: reportName = buildReportName(profileInfo.appName, profileName) report = Profiler.profile( app, profileInfo, reportName, benchmarkPath, False, heartbeatInterval=heartbeatInterval, samplesFileSize=samplesFileSize, duration=duration, cprofile=cprofile ) return profileInfo, report
def probes(profileInfoPath): """ Attaches to application and loads probe data :param profileInfoPath: Path to profile info module :type profileInfoPath: str """ profileInfo = loadProfileInfo(profileInfoPath) app = XpediteApp('app', profileInfo.appHost, profileInfo.appInfo) return _loadProbes(app), profileInfo
def loadProfileInfo(profileInfoPath, remote=None): """ Load profile information from a profileInfo.py file, set a default application information file, and set the profile information's host if the application is running remotely @param remote: Remote environment information if a remote host is passed to the pytest parser @type remote: C{xpedite.transport.remote.Remote} """ from xpedite.profiler.profileInfo import loadProfileInfo profileInfo = loadProfileInfo(os.path.join(dataDir, profileInfoPath)) profileInfo.appInfo = os.path.join(dataDir, 'xpedite-appinfo.txt') if remote: profileInfo.appHost = remote.host return profileInfo
def report(profileInfoPath, runId, benchmarkPath=None, cprofile=None, profileName=None, verbose=None, result=None): """ Generates report for a previous profiling runs :param profileInfoPath: Path to profile info module :type profileInfoPath: str :param runId: Unique identifier for a previous run :type runId: str :param benchmarkPath: Path to persist profile data for benchmarking :type benchmarkPath: str :param cprofile: Handle to capture self profile Xpedite report generation code (Default value = None) :type cprofile: C{xpedite.selfProfile.CProfile} :param profileName: Name of the profile report :type profileName: str :param verbose: Flag to enable, verbose logging :type verbose: bool :param result: Object for gathering and storing profile results :type result: xpedite.jupyter.result.Result """ if verbose: enableVerboseLogging() profileInfo = loadProfileInfo(profileInfoPath) validateBenchmarkPath(benchmarkPath) app = XpediteDormantApp(profileInfo.appName, profileInfo.appHost, profileInfo.appInfo, runId) with app: from xpedite.jupyter.result import Result result = result if result else Result() reportName = buildReportName(profileInfo.appName, profileName) Profiler.profile(app, profileInfo, reportName, benchmarkPath, True, result, cprofile=cprofile) return profileInfo, result
def buildNotebook(binary, remote=None): """ Test to confirm a Jupyter notebook can be creating from profile information and results generated by xpedite record """ import tempfile import xpedite.jupyter.driver profileInfo = loadProfileInfo(os.path.join(dataDir, 'profileInfo.py'), remote) app, profiles, result = runXpediteRecord(binary, profileInfo, remote) tempDir = tempfile.mkdtemp() tempDataDir = os.path.join(tempDir, 'xpData') os.mkdir(tempDataDir) notebookPath = os.path.join(tempDir, 'xpediteTest.ipynb') dataFilePath = os.path.join(tempDir, 'xpData/xpediteTest.xpd') notebook = xpedite.jupyter.driver.buildNotebook(profileInfo.appName, result, profiles, notebookPath, dataFilePath, app.xpediteApp.runId) return notebook, dataFilePath, app, result