Repository navigation
perf(esp32): record the core leg of the concurrent compile region (#1414) - #1816
Conversation
) compile-core-variant spans a tokio::join! of the core and sketch source sets, so with a hydrated core cache (zero files compiled) it reported the sketch's compile time as if it were the core's. Record compile-core from the core set's own start, alongside the existing compile-sketch, and document that the region is the join rather than either leg. Adds PerfTimer::recorded/activate so a caller can assert on one phase without re-parsing the summary line or mutating process env.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
CI note: soldr reports that dylint 6.2.0 has no pre-deployed driver for This PR stays unmerged until the pin bump lands; nothing in the diff needs to change. |
The custom `ban_std_pathbuf` dylint scans test code too, and the new compile_phases fixture returned `Vec<std::path::PathBuf>`; Dylint Full failed on it once the 6.2.0 re-pin (#1819) let the lane actually run. Return `Vec<NormalizedPath>` instead (it implements `AsRef<Path>`, so `CompileTarget` is unchanged). Behavior identical: the same two tests pass.
Part of #1414 (item 2: "
compile-core-variantcosts 1.14 s having compiled nothing").The defect
compile_core_and_sketchruns the framework-core and sketch source sets under onetokio::join!, and thecompile-core-variantphase guard covers that join. The phase therefore reports the longer leg, not the core's cost. On a hydrated core cache the core set compiles zero files but still inherits the sketch TU's compile time, so the perf log claims the core spent ~1.3 s compiling nothing.That is the measurement #1414 item 2 recorded (1,137 ms, "Compiled 0 files"), and it is why the issue's phase table reads as if core compilation were a hot spot.
The change
compile-corefrom the core set's own start (before submission), alongside the existingcompile-sketch. Both legs are now independent numbers.compile-core-variantas the region measurement, and document that it is the join — the longer of the two legs — so it is no longer readable as "time the core spent".PerfTimer::recorded(name)returns one phase's duration;PerfTimer::activate()forces recording without depending on the cachedFBUILD_PERF_LOGOnceLock. Together they let the phase accounting be asserted in tests instead of eyeballed from a log line.Verification (real builds,
FBUILD_PERF_LOG_JSON)Built
fbuild-cli+fbuild-daemonfrom this branch and ran a freshesp32-s3-devkitc-1project directory (arduino-esp32 3.3.12, xtensa-esp-elf 14.2.0), daemon stopped beforehand so the env applies:compile-corecompile-sketchcompile-core-variantCold: the region correctly tracks the core (the longer leg). Hydrated: the old log attributed 660 ms to the core while it compiled nothing — the new log says 129 ms, which is the real cost of resolving/stating the 60 already-fresh core objects. That 129 ms residual (not zero) is the next thing worth looking at, and it is now visible.
Tests
compile_phases_tests.rs: empty core set records a near-zerocompile-corewhilecompile-sketchcarries the 60 ms fake compile delay, and the region spans the sketch leg; with two core TUs both legs are recorded independently.perf_logunit tests forrecorded(accumulates,Nonefor an unrecorded phase) andactivate.No behaviour change: this only separates two measurements that were already being taken.