| #
b9321188
|
| 13-Jul-2023 |
Toby Isaac <toby.isaac@gmail.com> |
Profiling: Add nested PetscLogHandler implementation
This log handler has behavior like the behavior of PetscLogNestedBegin().
Unlike the implementation of PetscLogHandler_Default, I did not try to
Profiling: Add nested PetscLogHandler implementation
This log handler has behavior like the behavior of PetscLogNestedBegin().
Unlike the implementation of PetscLogHandler_Default, I did not try to do a faithful translation of the existing nested logging behavior, for two reasons.
- The existing implementation keeps sorted lists of nested paths ("Event A;Event B;"), and for each of those paths keeps a sorted list of the top-level events ("Event C", "Event D") that map that path to other paths (path + event => other path). It's a complicated data structure, and the benefit of the sorting (O(log n) lookup) is probably not worth the more expensive insertion cost each time a new path + event combo appears. Instead I implemented the path + event => other path lookup as a hash map, which simplified the implementation significantly.
- The existing implementation assigns an event to each path, modifying the event registry in place. This messes things up if you want to both -log_view and -log_view ::ascii_flamegraph output, the original motivation for refactoring the profiling infrastructure. In the new implementation, the nested handler has its own PetscLogState that it modifies, and an inner copy of PetscLogHandler_Default the acts on that nested state.
- The PetscLogGlobalNames data structure also simplifies the construction of a linearized tree of events in the final viewing stage, although the low-level xml construction routines are copied almost verbatim from the previous implementation.
show more ...
|