Skip to content

Step 1: report stage timings, disk cache size and complete run duration #600

Closed

Description

@dancmari

Step 1 needs a consistent timing report for the complete operation, including disk-cache preparation and result writing. The existing elapsed value has different boundaries depending on how the program is run, which makes performance comparisons ambiguous.

Verified by source inspection at current main, 64b1d5f6e37816338e3ffd8ad8736ec2e0030a1f:

  • In the automatic GUI flow, the saved/popup duration starts immediately before Step 2 and stops before save_results(). It excludes loading, initial trajectory preparation, initial cache construction, result writing and later cache deletion. Initial cache files are already written in Step 1. Runtime cache reads/spill work within Step 2 are part of that processing duration.
  • The CLI timer covers Step 1 and Step 2, including initial cache construction, but still stops before export and cleanup. Manual GUI Save result passes 0.0 as elapsed time.
  • The live GUI counter starts before loading and continues during saving, so its scope differs from the final popup/JSON value. Pauses are not reported separately.
  • save_processing_results_json() stores the caller's value as processing_info.elapsed_time_seconds. There are no stage durations, cache sizes/file counts or cleanup results. Export also creates additional session_chunk_*.cache files, so cache size after preparation is not necessarily its peak size.
  • remove_cache() only logs START/FINISHED/FAILED. In the normal GUI flow it runs from on_exit() when closing the application, after the saved-results popup; CLI cleanup runs after saving the JSON. Neither path persists a cleanup duration or status.

Per-worker stopwatches, optimization logs and profiler zones already exist, but they do not provide this complete, persisted report. For example, total_optimization_time is sampled from a cumulative stopwatch, not a sum of solver-only durations.

Requested behavior:

  1. Record explicitly defined stage durations for loading/initialization, cache preparation, odometry, result export and cache cleanup, plus an end-to-end total. Use a monotonic clock for durations. Define pause/idle handling and distinguish exclusive stages from nested sub-timings to prevent double-counting. Document the boundary for final report serialization itself.
  2. Persist these measurements in HDMapping_results_*.json and show the same labeled values in the completion popup. Give the existing elapsed field a documented meaning or retain it as a legacy field alongside unambiguous new fields. GUI, CLI and manual re-saving must use consistent definitions; an unavailable measurement should not become a fabricated zero.
  3. Report disk-cache file count and logical bytes after initial construction and at peak use, including export-created temporary chunks. Label optional spill files separately. These are disk-cache metrics, distinct from installed RAM or GPU display buffers.
  4. Show completion only after the last scheduled output writer has finished, and after cleanup when cleanup belongs to that operation. If the GUI retains cache for later editing/consistency/re-saving, explicitly report it as retained/deferred. Do not delete needed cache prematurely or count subsequent interactive idle time as processing. Persist the actual cleanup duration/result when cleanup later occurs.
  5. Report success, partial failure, cancellation and cleanup failure accurately. The final popup must not imply that all files were successfully written or cache deleted when those operations failed.

Acceptance: a complete run, paused run and manual re-save should produce matching JSON/popup stage summaries with documented totals. Cache growth during export and final cleanup must be visible; the total must include the stages it claims to include. Final metadata should be written/updated at finalization, rather than merely reusing a duration captured before export.

Related previous issues: #173 (elapsed GUI counter), #333 (results metadata), #489 (cache cleanup). This concerns run accounting and completion reporting, separately from rendering performance in #594/#599.

Activity

  1. dancmari commented on Nov 1, 2026

    @dancmari
    ContributorAuthor

    I would extend this proposal so that HDMapping_results_*.json becomes a useful analysis report for an individual run, covering resource consumption as well as timings.

    Live resource monitoring and persisted summaries

    In the progress window, show clearly labeled current and run-maximum values for:

    • Application RAM: resident memory/working set. Keep process consumption distinct from total system RAM; also show available system RAM as context.
    • Application GPU memory: dedicated and shared GPU memory separately, attributed to the process and identified by adapter where supported. Do not label total GPU-wide usage or just the renderer's own buffer allocations as the application's measured VRAM usage. Unsupported/unreliable measurements should be explicitly unavailable.
    • Application private committed memory: the process's contribution to system commit, alongside system commit usage/limit and remaining headroom. This is especially relevant when processing exceeds physical RAM. Windows PagefileUsage/PrivateUsage report commit charge, not the actual number of bytes currently stored in pagefile.sys; the UI/report must preserve that distinction. If actual paging activity or disk-backed residency can be measured reliably, report it as a separate metric with its source and limitations, rather than deriving it by subtracting working set from commit.
    • Pagefile storage: identify every active pagefile's volume and show current free disk space there, not only on the input-data drive. Report pagefile size/system-wide usage where available, clearly separated from process commit. Also monitor cache/output volumes; deduplicate volumes used for multiple purposes. Free disk space is useful context, not a guarantee that the system can commit that amount of additional memory.

    Persist time-weighted averages and sampled maxima for memory metrics in the JSON, both for the complete measured operation and preferably by stage. For disk space, the important additional statistic is the minimum available space, with start/end values and average/maximum where useful. Keep raw sizes in bytes and format human-readable units in the GUI.

    Record sampling interval, coverage/sample count, metric source/scope and unavailable values (null with a reason, not zero). Maxima must describe this run, not silently reuse process-lifetime high-water marks from a previous run in the same application. Label sampled peaks as such; they can miss short spikes. Use the timing/pause boundaries defined above consistently for resource averages too. A modest sampling cadence, e.g. about once per second, should avoid adding meaningful overhead or querying the OS on every rendered frame.

    Monitoring should cover loading/cache preparation, processing, export and scheduled cleanup. At present loadData() runs step1() on the UI thread before starting the processing worker, so the loading dialog explicitly says the window will not respond. Live indicators during that stage require responsive progress reporting as well; adding fields only to the existing processing window would leave the initial memory/cache peak unexplained. Sampling must remain independent of frame rate and rendering options, with safe publication to the GUI/report writer.

    The final popup should show a compact timing/resource summary and the report location. A versioned JSON schema and run identifier would make later comparisons easier. Retain the existing software/hardware/settings metadata and link the measurements to stage boundaries and completion status. This would help explain whether a run was limited by computation, memory pressure, paging or storage, without treating any single counter as proof of the cause.

    References for the terminology: Windows process memory counters, dedicated/shared GPU memory, known GPU process-counter limitations, pagefile enumeration.

    Related usability suggestion: remember dialog locations

    As a separate follow-up, remember the last successfully used location across application restarts, independently for:

    1. Raw-data loading.
    2. Parameter-file loading.
    3. Parameter-file saving.

    The current mandeye::fd wrapper uses a single in-memory lastLocationHint, initialized to ".". File open/save updates that shared hint, while SelectFolder() only reads it and does not update it. There is no persistence of these locations in this wrapper, so this is more than merely selecting a different default directory.

    Store these as per-user application preferences, separate from processing parameters and run results. Update after successful use; cancellation or failed operations should preserve the previous location. Handle missing/removable/network locations gracefully and provide a way to reset the remembered paths. Opening the app should suggest the location when the user opens the relevant dialog, without automatically loading or processing the previous dataset. Drag-and-drop/explicit paths should keep working and may update the corresponding preference after successful loading.

    I suggest keeping resource accounting in #600 and tracking persistent dialog locations separately, so both changes can be reviewed independently. Suggestions on useful metrics and platform support are welcome.

  2. dancmari commented on Nov 1, 2026

    @dancmari
    ContributorAuthor

    Implemented in #608: #608

    The PR covers run timings, resource/cache accounting and the shared GUI/JSON report. Persistent dialog locations will be proposed separately. Local test scripts, fixtures and artifacts are not included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions