Skip to content

Commit db8b76d

Browse files
[NFC][llvm-exegesis] Clean up BenchmarkRunner comments
There were a couple things in the comments of BenchmarkRunner.cpp (and maybe other files, I can't really remember) that were bugging me. This patch fixes a couple of minor issues specifically in BenchmarkRunner like typos and makes a couple instances more clear.
1 parent fbce244 commit db8b76d

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,10 @@ class SubProcessFunctionExecutorImpl
309309
}
310310

311311
if (ParentOrChildPID == 0) {
312-
// We are in the child process, close the write end of the pipe
312+
// We are in the child process, close the write end of the pipe.
313313
close(PipeFiles[1]);
314314
// Unregister handlers, signal handling is now handled through ptrace in
315-
// the host process
315+
// the host process.
316316
sys::unregisterHandlers();
317317
prepareAndRunBenchmark(PipeFiles[0], Key);
318318
// The child process terminates in the above function, so we should never
@@ -371,7 +371,7 @@ class SubProcessFunctionExecutorImpl
371371
int ChildExitCode = WEXITSTATUS(ChildStatus);
372372
if (ChildExitCode == 0) {
373373
// The child exited succesfully, read counter values and return
374-
// success
374+
// success.
375375
auto CounterValueOrErr = Counter->readOrError();
376376
if (!CounterValueOrErr)
377377
return CounterValueOrErr.takeError();
@@ -387,7 +387,7 @@ class SubProcessFunctionExecutorImpl
387387

388388
return Error::success();
389389
}
390-
// The child exited, but not successfully
390+
// The child exited, but not successfully.
391391
return make_error<Failure>(
392392
"Child benchmarking process exited with non-zero exit code: " +
393393
childProcessExitCodeToString(ChildExitCode));
@@ -423,7 +423,7 @@ class SubProcessFunctionExecutorImpl
423423
// user inspect a core dump.
424424
disableCoreDumps();
425425

426-
// The following occurs within the benchmarking subprocess
426+
// The following occurs within the benchmarking subprocess.
427427
pid_t ParentPID = getppid();
428428

429429
Expected<int> CounterFileDescriptorOrError =
@@ -436,7 +436,7 @@ class SubProcessFunctionExecutorImpl
436436

437437
// Glibc versions greater than 2.35 automatically call rseq during
438438
// initialization. Unmapping the region that glibc sets up for this causes
439-
// segfaults in the program Unregister the rseq region so that we can safely
439+
// segfaults in the program. Unregister the rseq region so that we can safely
440440
// unmap it later
441441
#ifdef GLIBC_INITS_RSEQ
442442
long RseqDisableOutput =
@@ -559,7 +559,7 @@ BenchmarkRunner::getRunnableConfiguration(
559559
}
560560

561561
// Assemble enough repetitions of the snippet so we have at least
562-
// MinInstructios instructions.
562+
// MinInstructions instructions.
563563
if (BenchmarkPhaseSelector >
564564
BenchmarkPhaseSelectorE::PrepareAndAssembleSnippet) {
565565
auto Snippet =
@@ -636,9 +636,10 @@ std::pair<Error, Benchmark> BenchmarkRunner::runConfiguration(
636636
}
637637
assert(BenchmarkResult.MinInstructions > 0 && "invalid MinInstructions");
638638
for (BenchmarkMeasure &BM : *NewMeasurements) {
639-
// Scale the measurements by instruction.
639+
// Scale the measurements by the number of instructions.
640640
BM.PerInstructionValue /= BenchmarkResult.MinInstructions;
641-
// Scale the measurements by snippet.
641+
// Scale the measurements by the number of times the entire snippet is
642+
// repeated.
642643
BM.PerSnippetValue /=
643644
std::ceil(BenchmarkResult.MinInstructions /
644645
static_cast<double>(BenchmarkResult.Key.Instructions.size()));

0 commit comments

Comments
 (0)