@@ -142,30 +142,30 @@ elements for a couple hypothetical keys and values.::
142142 +--------------+ | |
143143 n_keys = n_fields - n_vals | |
144144
145- The hist_data n_vals and n_fields delineate the extent of the fields[] | |
146- array and separate keys from values for the rest of the code. | |
147-
148- Below is a run-time representation of the tracing_map part of the | |
149- histogram, with pointers from various parts of the fields[] array | |
150- to corresponding parts of the tracing_map. | |
151-
152- The tracing_map consists of an array of tracing_map_entrys and a set | |
153- of preallocated tracing_map_elts (abbreviated below as map_entry and | |
154- map_elt). The total number of map_entrys in the hist_data.map array = | |
155- map->max_elts (actually map->map_size but only max_elts of those are | |
156- used. This is a property required by the map_insert() algorithm). | |
157-
158- If a map_entry is unused, meaning no key has yet hashed into it, its | |
159- .key value is 0 and its .val pointer is NULL. Once a map_entry has | |
160- been claimed, the .key value contains the key's hash value and the | |
161- .val member points to a map_elt containing the full key and an entry | |
162- for each key or value in the map_elt.fields[] array. There is an | |
163- entry in the map_elt.fields[] array corresponding to each hist_field | |
164- in the histogram, and this is where the continually aggregated sums | |
165- corresponding to each histogram value are kept. | |
166-
167- The diagram attempts to show the relationship between the | |
168- hist_data.fields[] and the map_elt.fields[] with the links drawn | |
145+ The hist_data n_vals and n_fields delineate the extent of the fields[]
146+ array and separate keys from values for the rest of the code.
147+
148+ Below is a run-time representation of the tracing_map part of the
149+ histogram, with pointers from various parts of the fields[] array
150+ to corresponding parts of the tracing_map.
151+
152+ The tracing_map consists of an array of tracing_map_entrys and a set
153+ of preallocated tracing_map_elts (abbreviated below as map_entry and
154+ map_elt). The total number of map_entrys in the hist_data.map array =
155+ map->max_elts (actually map->map_size but only max_elts of those are
156+ used. This is a property required by the map_insert() algorithm).
157+
158+ If a map_entry is unused, meaning no key has yet hashed into it, its
159+ .key value is 0 and its .val pointer is NULL. Once a map_entry has
160+ been claimed, the .key value contains the key's hash value and the
161+ .val member points to a map_elt containing the full key and an entry
162+ for each key or value in the map_elt.fields[] array. There is an
163+ entry in the map_elt.fields[] array corresponding to each hist_field
164+ in the histogram, and this is where the continually aggregated sums
165+ corresponding to each histogram value are kept.
166+
167+ The diagram attempts to show the relationship between the
168+ hist_data.fields[] and the map_elt.fields[] with the links drawn
169169between diagrams::
170170
171171 +-----------+ | |
@@ -440,31 +440,31 @@ sched_waking histogram
440440 n_keys = n_fields - n_vals | | |
441441 | | |
442442
443- This is very similar to the basic case. In the above diagram, we can | | |
444- see a new .flags member has been added to the struct hist_field | | |
445- struct, and a new entry added to hist_data.fields representing the ts0 | | |
446- variable. For a normal val hist_field, .flags is just 0 (modulo | | |
447- modifier flags), but if the value is defined as a variable, the .flags | | |
448- contains a set FL_VAR bit. | | |
449-
450- As you can see, the ts0 entry's .var.idx member contains the index | | |
451- into the tracing_map_elts' .vars[] array containing variable values. | | |
452- This idx is used whenever the value of the variable is set or read. | | |
453- The map_elt.vars idx assigned to the given variable is assigned and | | |
454- saved in .var.idx by create_tracing_map_fields() after it calls | | |
455- tracing_map_add_var(). | | |
456-
457- Below is a representation of the histogram at run-time, which | | |
458- populates the map, along with correspondence to the above hist_data and | | |
459- hist_field data structures. | | |
460-
461- The diagram attempts to show the relationship between the | | |
462- hist_data.fields[] and the map_elt.fields[] and map_elt.vars[] with | | |
463- the links drawn between diagrams. For each of the map_elts, you can | | |
464- see that the .fields[] members point to the .sum or .offset of a key | | |
465- or val and the .vars[] members point to the value of a variable. The | | |
466- arrows between the two diagrams show the linkages between those | | |
467- tracing_map members and the field definitions in the corresponding | | |
443+ This is very similar to the basic case. In the above diagram, we can
444+ see a new .flags member has been added to the struct hist_field
445+ struct, and a new entry added to hist_data.fields representing the ts0
446+ variable. For a normal val hist_field, .flags is just 0 (modulo
447+ modifier flags), but if the value is defined as a variable, the .flags
448+ contains a set FL_VAR bit.
449+
450+ As you can see, the ts0 entry's .var.idx member contains the index
451+ into the tracing_map_elts' .vars[] array containing variable values.
452+ This idx is used whenever the value of the variable is set or read.
453+ The map_elt.vars idx assigned to the given variable is assigned and
454+ saved in .var.idx by create_tracing_map_fields() after it calls
455+ tracing_map_add_var().
456+
457+ Below is a representation of the histogram at run-time, which
458+ populates the map, along with correspondence to the above hist_data and
459+ hist_field data structures.
460+
461+ The diagram attempts to show the relationship between the
462+ hist_data.fields[] and the map_elt.fields[] and map_elt.vars[] with
463+ the links drawn between diagrams. For each of the map_elts, you can
464+ see that the .fields[] members point to the .sum or .offset of a key
465+ or val and the .vars[] members point to the value of a variable. The
466+ arrows between the two diagrams show the linkages between those
467+ tracing_map members and the field definitions in the corresponding
468468hist_data fields[] members.::
469469
470470 +-----------+ | | |
@@ -565,40 +565,40 @@ hist_data fields[] members.::
565565 | | | |
566566 +---------------+ | |
567567
568- For each used map entry, there's a map_elt pointing to an array of | |
569- .vars containing the current value of the variables associated with | |
570- that histogram entry. So in the above, the timestamp associated with | |
571- pid 999 is 113345679876, and the timestamp variable in the same | |
572- .var.idx for pid 4444 is 213499240729. | |
573-
574- sched_switch histogram | |
575- ---------------------- | |
576-
577- The sched_switch histogram paired with the above sched_waking | |
578- histogram is shown below. The most important aspect of the | |
579- sched_switch histogram is that it references a variable on the | |
580- sched_waking histogram above. | |
581-
582- The histogram diagram is very similar to the others so far displayed, | |
583- but it adds variable references. You can see the normal hitcount and | |
584- key fields along with a new wakeup_lat variable implemented in the | |
585- same way as the sched_waking ts0 variable, but in addition there's an | |
586- entry with the new FL_VAR_REF (short for HIST_FIELD_FL_VAR_REF) flag. | |
587-
588- Associated with the new var ref field are a couple of new hist_field | |
589- members, var.hist_data and var_ref_idx. For a variable reference, the | |
590- var.hist_data goes with the var.idx, which together uniquely identify | |
591- a particular variable on a particular histogram. The var_ref_idx is | |
592- just the index into the var_ref_vals[] array that caches the values of | |
593- each variable whenever a hist trigger is updated. Those resulting | |
594- values are then finally accessed by other code such as trace action | |
595- code that uses the var_ref_idx values to assign param values. | |
596-
597- The diagram below describes the situation for the sched_switch | |
568+ For each used map entry, there's a map_elt pointing to an array of
569+ .vars containing the current value of the variables associated with
570+ that histogram entry. So in the above, the timestamp associated with
571+ pid 999 is 113345679876, and the timestamp variable in the same
572+ .var.idx for pid 4444 is 213499240729.
573+
574+ sched_switch histogram
575+ ----------------------
576+
577+ The sched_switch histogram paired with the above sched_waking
578+ histogram is shown below. The most important aspect of the
579+ sched_switch histogram is that it references a variable on the
580+ sched_waking histogram above.
581+
582+ The histogram diagram is very similar to the others so far displayed,
583+ but it adds variable references. You can see the normal hitcount and
584+ key fields along with a new wakeup_lat variable implemented in the
585+ same way as the sched_waking ts0 variable, but in addition there's an
586+ entry with the new FL_VAR_REF (short for HIST_FIELD_FL_VAR_REF) flag.
587+
588+ Associated with the new var ref field are a couple of new hist_field
589+ members, var.hist_data and var_ref_idx. For a variable reference, the
590+ var.hist_data goes with the var.idx, which together uniquely identify
591+ a particular variable on a particular histogram. The var_ref_idx is
592+ just the index into the var_ref_vals[] array that caches the values of
593+ each variable whenever a hist trigger is updated. Those resulting
594+ values are then finally accessed by other code such as trace action
595+ code that uses the var_ref_idx values to assign param values.
596+
597+ The diagram below describes the situation for the sched_switch
598598histogram referred to before::
599599
600- # echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0' >> | |
601- events/sched/sched_switch/trigger | |
600+ # echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0' >>
601+ events/sched/sched_switch/trigger
602602 | |
603603 +------------------+ | |
604604 | hist_data | | |
0 commit comments