diff options
author | eldritch horrors <pennae@lix.systems> | 2024-03-04 04:08:28 +0100 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-03-04 04:36:47 +0100 |
commit | 6feba520085c78f105cc9ebce4f81ed8cdaed085 (patch) | |
tree | c78c1f44f9ca32292828f419407961e0cf8e6251 /src/libexpr/eval.hh | |
parent | fd1299cef399ec0c33e2b7416c63d78553dc3ced (diff) |
Merge pull request #8895 from hercules-ci/gc-before-stats
eval: Run a full GC before printing stats
(cherry picked from commit aeea49609be014b1928c95b7ec28dbedeb4f032a)
Change-Id: I47a23d3a7a47ea61d9a2b5727b638f879f3aaf1e
Diffstat (limited to 'src/libexpr/eval.hh')
-rw-r--r-- | src/libexpr/eval.hh | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh index 553cbe4fd..42dd73d11 100644 --- a/src/libexpr/eval.hh +++ b/src/libexpr/eval.hh @@ -709,9 +709,25 @@ public: void concatLists(Value & v, size_t nrLists, Value * * lists, const PosIdx pos, std::string_view errorCtx); /** - * Print statistics. + * Print statistics, if enabled. + * + * Performs a full memory GC before printing the statistics, so that the + * GC statistics are more accurate. + */ + void maybePrintStats(); + + /** + * Print statistics, unconditionally, cheaply, without performing a GC first. + */ + void printStatistics(); + + /** + * Perform a full memory garbage collection - not incremental. + * + * @return true if Nix was built with GC and a GC was performed, false if not. + * The return value is currently not thread safe - just the return value. */ - void printStats(); + bool fullGC(); /** * Realise the given context, and return a mapping from the placeholders |