| | 1 | == How to add new graphs to TS == |
| | 2 | |
| | 3 | I'm afraid this is not understandable without the context of Threadscope internals and without some extra explanation. Sorry. Please ask questions. |
| | 4 | |
| | 5 | {{{ |
| | 6 | |
| | 7 | To draw a graph from an eventlog I need the data preprocessed and then I just pick a portion to show on-screen. |
| | 8 | Best if I can take the data from a validation profile and then just process some more, as we do for Histogram (from spark profile). |
| | 9 | In this case we know the data makes sense and we can use the finite automaton validation engine |
| | 10 | for all the FA mangling of the list of events. |
| | 11 | So the workflow for drawing a graph (and implementing a new one), as seen in Histogram, is: |
| | 12 | |
| | 13 | 1. parse the events in ghc-events |
| | 14 | 2. optionally validate them in ghc-events |
| | 15 | 3. generate a profile using a specific profile function for validator |
| | 16 | 4. preprocess the profile some more and store until eventlog reloaded |
| | 17 | 5. select the data for the required interval (or zoom/pan factor) |
| | 18 | 6. process yet more |
| | 19 | 7. draw |
| | 20 | |
| | 21 | If the data is very dense, storing it in step 4 needs to use a zoom-tree of some kind. |
| | 22 | For speedup under certain usage scenarios (many redraws with only some parameters changing), |
| | 23 | the data can be cached in step 5 (for user-defined graphs) or step 6 (for fixed graphs), |
| | 24 | until the relevant interval or zoom/pan or other parameter changes. |
| | 25 | |
| | 26 | For simple events that do not require a lot of finite automaton mangling, we may skip steps 2 and 3. |
| | 27 | If our spark graphs were built from the detailed spark events, we'd best use the validator profiles, |
| | 28 | but instead we use the spark counters, so the profiling work is actually done in GHC, so steps 2 and 3 are not needed. |
| | 29 | For such simple graphs without FA (allocation rate is an example), the existing zoom-trees or the zoom-cache library suffice. |
| | 30 | Allocation rate happens to be sampled as often as spark counters, |
| | 31 | so it actually fits best into the spark trees, no new tree kind is needed. |
| | 32 | But generally, we may be best off to set up a single zoom tree with very small sampling interval |
| | 33 | and resample all data (sparks included) into that tree. |
| | 34 | We'd lose some data, unless the sampling interval is 1, but we'd gain flexibility |
| | 35 | and the accuracy of visualization of spark rates would actually improve |
| | 36 | (except at very high zoom levels where the resampling noise overweights |
| | 37 | the more accurate rate of change calculation due to equal sample intervals). |
| | 38 | |
| | 39 | GC is a border case; there's clearly a FA, but now that we don't have to track RequestParGC, |
| | 40 | it only has 6 states and the transitions are simple compared to the actual data processing that is triggered by transitions. |
| | 41 | So if we don't want to validate GC events just for validation sake, |
| | 42 | it's IMHO not mandatory to encode the FA rules in the validator profile and rewrite the code to use that. |
| | 43 | But if we already validate GC, then we should also make use of the validation profile, |
| | 44 | if only to ensure consistency between validation and visualization. |
| | 45 | |
| | 46 | Totally new kinds of graphs for old events require changes from step 3 onward. |
| | 47 | For user-defined graphs, if we gather enough data in an efficient format (zoom trees) in steps 3--5, |
| | 48 | we may just recompute 6 and 7 for each drawing, based on the current user graph definitions. |
| | 49 | |
| | 50 | }}} |