Back to home page

EIC code displayed by LXR

 
 

    


Warning, /EICrecon/src/utilities/callgraph/README.md is written in an unsupported language. File is not indexed.

0001 # Callgraph Plugin
0002 
0003 This plugin creates DOT (graphviz) files from JANA2 call graphs for visualization purposes.
0004 It is based on JANA2's `janadot` plugin, but is a separate plugin with its own name and
0005 parameters, so `-Pplugins=janadot` still loads JANA2's version.
0006 
0007 ## Overview
0008 
0009 The callgraph plugin records call stack information during event processing and generates DOT format files that can be processed by graphviz to create visual call graphs. It automatically splits graphs by plugin/detector subsystem for better organization and readability, with support for user-defined group overrides.
0010 
0011 ## Usage
0012 
0013 To use the plugin, add it to your eicrecon command:
0014 
0015 ```bash
0016 eicrecon -Pplugins=callgraph sim_file.edm4hep.root
0017 ```
0018 
0019 ## Configuration Parameters
0020 
0021 The plugin supports the following configuration parameters:
0022 
0023 - `callgraph:output_file` (default: "callgraph.dot") - Output DOT filename
0024 - `callgraph:enable_splitting` (default: true) - Enable splitting graphs into multiple files by plugin
0025 - `callgraph:LogLevel` (default: `eicrecon:LogLevel`) - Level of the plugin's messages
0026 - `callgraph:group:<GroupName>="Tag,...,color_<color>"` - Define a custom group
0027   named `<GroupName>` (your choice) that overrides plugin-based assignment for the listed
0028   factories; see [Custom Group Overrides](#custom-group-overrides) below
0029 
0030 ## Plugin-based Splitting (Default)
0031 
0032 By default, the plugin groups components by detector subsystem plugins:
0033 
0034 ```bash
0035 eicrecon -Pplugins=callgraph sim_file.edm4hep.root
0036 ```
0037 
0038 This generates:
0039 - `callgraph.tracking.dot` - All tracking-related components
0040 - `callgraph.BEMC.dot` - Barrel ECAL components
0041 - `callgraph.EHCAL.dot` - Backward HCAL components
0042 - `callgraph.dot` - Overall inter-plugin connection summary
0043 
0044 ## Custom Group Overrides
0045 
0046 You can override the default plugin-based grouping for specific factories on the command line.
0047 Each entry is a factory's tag: the name on its box in the graphs, which is the name of its output
0048 collection (the first one, for a factory with several):
0049 
0050 ```bash
0051 # Override default grouping for specific factories
0052 eicrecon -Pplugins=callgraph \
0053   -Pcallgraph:group:MyCustomGroup="EcalBarrelClustersWithoutShapes,EcalBarrelClusters,color_blue" \
0054   sim_file.edm4hep.root
0055 ```
0056 
0057 Group syntax: `Tag,AnotherTag,color_<color>` (e.g. `color_blue`). An entry that matches nothing
0058 in the call graph is ignored, with a warning at the end of the job.
0059 
0060 An entry can also be written as `ObjectType:Tag`, where the object type is the factory's
0061 `GetObjectName()`. Only factories based on `JFactoryT` have an object type, and they must be
0062 written this way; for all other factories, including every `JOmniFactory`, it is ignored.
0063 
0064 ## Output Files
0065 
0066 When splitting is enabled (default), multiple files are created:
0067 
0068 - `callgraph.plugin_name.dot` - Plugin-specific graphs (or custom group name if overridden)
0069 - `callgraph.dot` - Main graph showing inter-plugin/inter-group connections
0070 
0071 ## Reading the Graphs
0072 
0073 Each graph has a legend under its title that defines the quantities in its labels:
0074 
0075 - An arrow `A -> B` means that `A` requested data from `B`. Its label shows the number of
0076   requests (*calls*, including those served from cache) and the *edge time*: the time `A`
0077   waited for that data, summed over all calls. A factory runs once per event, for the first
0078   request; that request's time includes the factory's self time and all of its outgoing edges,
0079   while later requests are served from cache and add almost nothing.
0080 - A node's label shows its *self time*: the time spent in its own code, not waiting for its
0081   inputs. It equals the sum of its incoming edge times minus the sum of its outgoing edge
0082   times. Event processors make the top-level requests; their own time isn't measured (shown
0083   as 0), and the edges leaving them add up to the total.
0084 - All percentages, in all graphs, are relative to the same total `T`: the self time of all
0085   nodes, i.e. the time spent in all factories, summed over all events (on all threads).
0086 - In the overview graph, a plugin's time is the sum of its factories' self times, which also
0087   equals the sum of its incoming minus its outgoing edge times, as requests between factories
0088   in the same plugin cancel out. A plugin graph doesn't draw requests to or from other
0089   plugins, but they still count in these sums.
0090 
0091 ## Generating Graphics
0092 
0093 To convert DOT files to graphics:
0094 
0095 ```bash
0096 # For a single file
0097 dot -Tpdf callgraph.dot -o callgraph.pdf
0098 
0099 # For plugin-based splits
0100 dot -Tpdf callgraph.tracking.dot -o callgraph.tracking.pdf
0101 dot -Tpdf callgraph.BEMC.dot -o callgraph.BEMC.pdf
0102 
0103 # For custom groups
0104 dot -Tpdf callgraph.MyCustomGroup.dot -o callgraph.MyCustomGroup.pdf
0105 ```
0106 
0107 The overview graph (`callgraph.dot`) links to each plugin/group's file via an SVG URL, so generate
0108 those as SVG rather than PDF if you want the links to resolve when opened (e.g. in a browser):
0109 
0110 ```bash
0111 dot -Tsvg callgraph.dot -o callgraph.svg
0112 dot -Tsvg callgraph.tracking.dot -o callgraph.tracking.svg
0113 dot -Tsvg callgraph.MyCustomGroup.dot -o callgraph.MyCustomGroup.svg
0114 ```