Skip to content
This repository has been archived by the owner on Feb 4, 2020. It is now read-only.

Use CLCACHE_SINGLEFILE to display actual function calls in cProfile #367

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 27 additions & 15 deletions clcache/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1693,21 +1693,33 @@ def scheduleJobs(cache: Any, compiler: str, cmdLine: List[str], environment: Any

exitCode = 0
cleanupRequired = False
with concurrent.futures.ThreadPoolExecutor(max_workers=jobCount(cmdLine)) as executor:
jobs = []
for (srcFile, srcLanguage), objFile in zip(sourceFiles, objectFiles):
jobCmdLine = baseCmdLine + [srcLanguage + srcFile]
jobs.append(executor.submit(
processSingleSource,
compiler, jobCmdLine, srcFile, objFile, environment))
for future in concurrent.futures.as_completed(jobs):
exitCode, out, err, doCleanup = future.result()
printTraceStatement("Finished. Exit code {0:d}".format(exitCode))
cleanupRequired |= doCleanup
printOutAndErr(out, err)

if exitCode != 0:
break
if os.getenv('CLCACHE_SINGLEFILE'):
assert len(sourceFiles) == 1
assert len(objectFiles) == 1
srcFile, srcLanguage = sourceFiles[0]
objFile = objectFiles[0]
jobCmdLine = baseCmdLine + [srcLanguage + srcFile]
exitCode, out, err, doCleanup = processSingleSource(
compiler, jobCmdLine, srcFile, objFile, environment)
printTraceStatement("Finished. Exit code {0:d}".format(exitCode))
cleanupRequired |= doCleanup
printOutAndErr(out, err)
else:
with concurrent.futures.ThreadPoolExecutor(max_workers=jobCount(cmdLine)) as executor:
jobs = []
for (srcFile, srcLanguage), objFile in zip(sourceFiles, objectFiles):
jobCmdLine = baseCmdLine + [srcLanguage + srcFile]
jobs.append(executor.submit(
processSingleSource,
compiler, jobCmdLine, srcFile, objFile, environment))
for future in concurrent.futures.as_completed(jobs):
exitCode, out, err, doCleanup = future.result()
printTraceStatement("Finished. Exit code {0:d}".format(exitCode))
cleanupRequired |= doCleanup
printOutAndErr(out, err)

if exitCode != 0:
break

if cleanupRequired:
cleanCache(cache)
Expand Down