Skip to content

Commit 7ba5dc5

Browse files
committed
doc: clarify how we talk about info attributes
Uniformize and clarifies things. Use "name" instead of "key". Use "pair" when appropriate. Misc. Signed-off-by: Brice Goglin <[email protected]>
1 parent 8285b06 commit 7ba5dc5

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

doc/hwloc.doxy

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,12 +1965,11 @@ See ::hwloc_obj_attr_u for details.
19651965
\section attributes_info Custom string infos
19661966

19671967
Aside os these generic attribute fields, hwloc annotates
1968-
many objects with string attributes that are made of a key and a
1969-
value.
1968+
many objects with info attributes made of name and value strings.
19701969
Each object contains a list of such pairs that may be consulted
19711970
manually (looking at the object <tt>infos</tt> array field)
19721971
or using the hwloc_obj_get_info_by_name().
1973-
The user may additionally add new key-value pairs to any object using
1972+
The user may additionally add new name-value pairs to any object using
19741973
hwloc_obj_add_info() or the \ref cli_hwloc_annotate program.
19751974

19761975
Here is a non-exhaustive list of attributes that may be automatically
@@ -2048,7 +2047,7 @@ Unless specified, these info attributes are attached to the root object (Machine
20482047
<dl>
20492048
<dt>Backend (topology root object)</dt>
20502049
<dd>The name of a hwloc backend/component that added objects in the topology.
2051-
If several components were combined, multiple Backend keys may exist,
2050+
If several components were combined, multiple Backend pairs may exist,
20522051
with different values, for instance <tt>x86</tt>, <tt>Linux</tt> and
20532052
<tt>CUDA</tt>.
20542053
</dd>
@@ -3969,13 +3968,13 @@ with <tt>hwloc_topology_set_userdata_export_callback()</tt>
39693968
and <tt>hwloc_topology_set_userdata_import_callback()</tt>.
39703969

39713970
Each object may also contain some <em>info</em> attributes
3972-
(key name and value) that are setup by hwloc during discovery
3971+
(name and value strings) that are setup by hwloc during discovery
39733972
and that may be extended by the user with
39743973
<tt>hwloc_obj_add_info()</tt> (see also \ref attributes).
39753974
Contrary to the <tt>userdata</tt> field which is unique, multiple info
39763975
attributes may exist for each object, even with the same name.
39773976
These attributes are always exported to XML.
3978-
However, only character strings may be used as key names and values.
3977+
However, only character strings may be used as names and values.
39793978

39803979
It is also possible to insert Misc objects with a custom name
39813980
anywhere as a leaf of the topology (see \ref miscobjs).
@@ -4060,7 +4059,7 @@ but not in the other.
40604059

40614060
More changes may obviously be performed by manually modifying the XML export file.
40624061
Simple operations such as modifying object attributes (cache size, memory size
4063-
info keypairs, etc.), moving I/O subtrees, moving Misc objects, or removing
4062+
name-value info attributes, etc.), moving I/O subtrees, moving Misc objects, or removing
40644063
objects are easy to perform.
40654064

40664065
However, modifying CPU and Memory objects requires care since cpusets and nodesets

include/hwloc.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ struct hwloc_obj {
602602
* \note Its value must not be changed, hwloc_bitmap_dup() must be used instead.
603603
*/
604604

605-
struct hwloc_info_s *infos; /**< \brief Array of stringified info type=name. */
605+
struct hwloc_info_s *infos; /**< \brief Array of info attributes (name and value strings). */
606606
unsigned infos_count; /**< \brief Size of infos array. */
607607

608608
/* misc */
@@ -687,7 +687,7 @@ union hwloc_obj_attr_u {
687687
} osdev;
688688
};
689689

690-
/** \brief Object info
690+
/** \brief Object info attribute (name and value strings)
691691
*
692692
* \sa hwlocality_info_attr
693693
*/
@@ -1121,34 +1121,34 @@ HWLOC_DECLSPEC int hwloc_type_sscanf(const char *string,
11211121

11221122

11231123

1124-
/** \defgroup hwlocality_info_attr Consulting and Adding Key-Value Info Attributes
1124+
/** \defgroup hwlocality_info_attr Consulting and Adding Info Attributes
11251125
*
11261126
* @{
11271127
*/
11281128

1129-
/** \brief Search the given key name in object infos and return the corresponding value.
1129+
/** \brief Search the given name in object infos and return the corresponding value.
11301130
*
1131-
* If multiple keys match the given name, only the first one is returned.
1131+
* If multiple info attributes match the given name, only the first one is returned.
11321132
*
11331133
* \return A pointer to the value string if it exists.
1134-
* \return \c NULL if no such key exists.
1134+
* \return \c NULL if no such info attribute exists.
11351135
*
11361136
* \note The string should not be freed by the caller, it belongs to the hwloc library.
11371137
*/
11381138
static __hwloc_inline const char *
11391139
hwloc_obj_get_info_by_name(hwloc_obj_t obj, const char *name) __hwloc_attribute_pure;
11401140

1141-
/** \brief Add the given info name and value pair to the given object.
1141+
/** \brief Add the given name and value pair to the given object info attributes.
11421142
*
1143-
* The info is appended to the existing info array even if another key
1143+
* The info pair is appended to the existing info array even if another pair
11441144
* with the same name already exists.
11451145
*
11461146
* The input strings are copied before being added in the object infos.
11471147
*
11481148
* \return \c 0 on success, \c -1 on error.
11491149
*
11501150
* \note This function may be used to enforce object colors in the lstopo
1151-
* graphical output by using "lstopoStyle" as a name and "Background=#rrggbb"
1151+
* graphical output by adding "lstopoStyle" as a name and "Background=#rrggbb"
11521152
* as a value. See CUSTOM COLORS in the lstopo(1) manpage for details.
11531153
*
11541154
* \note If \p name or \p value contain some non-printable characters, they will
@@ -2666,7 +2666,7 @@ HWLOC_DECLSPEC hwloc_obj_t hwloc_topology_alloc_group_object(hwloc_topology_t to
26662666
* The \p subtype object attribute may be defined (to a dynamically
26672667
* allocated string) to display something else than "Group" as the
26682668
* type name for this object in lstopo.
2669-
* Custom name/value info pairs may be added with hwloc_obj_add_info() after
2669+
* Custom name-value info pairs may be added with hwloc_obj_add_info() after
26702670
* insertion.
26712671
*
26722672
* The group \p dont_merge attribute may be set to \c 1 to prevent

utils/hwloc/hwloc-calc.1in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ you should combine invocations:
4444
\fB\-\-cpukind\fR <n>, \fB\-\-cpukind\fR <infoname>=<infovalue>
4545
Only keep PUs whose CPU kind match.
4646
Either a single CPU kind is specified as an index,
47-
or the info name/value keypair will select matching kinds.
47+
or the info attribute name-value will select matching kinds.
4848

4949
When specified by index, it corresponds to hwloc ranking of CPU kinds
5050
which returns energy-efficient cores first, and high-performance

0 commit comments

Comments
 (0)