| 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 ...
|
| 78f1b9b4 | 13-Jul-2023 |
Toby Isaac <toby.isaac@gmail.com> |
Profiling: Implement the default PetscLogHandler
The existing default log handling that uses the PetscStageLog is translated in the PetscLogHandler_Default implementation of PetscLogHandler.
- Most
Profiling: Implement the default PetscLogHandler
The existing default log handling that uses the PetscStageLog is translated in the PetscLogHandler_Default implementation of PetscLogHandler.
- Most data that is global in the existing log handling is moved into the struct, with the exception of the raw counters.
- The registry data structures of PetscStageLog (eventLog, classLog) are not reproduced because they are now in the PetscLogState interface.
- PETSC_LOG_RESIZABLE_ARRAY is used to implement resizable arrays instead of PetscStageInfo, PetscEventPerfLog, and PetscClassPerfLog
- The tau perfstubs and MPE functionality is not reproduced because they will become new handlers on their own.
- The PetscLogGlobalNames provided by the PetscLogRegistry interface make the logging robust to differences in which events / stages are registered on which process and in which order.
Otherwise the functions are relatively faithful translations of the existing PetscStageLog functions into the new interface. When reviewing this commit it might help to have a diff between the PetscStageLog and PetscLogHandler_Default functions to see what changes between them. I am working on a way to attach that to the MR associated with this change.
show more ...
|