Skip to content

Commit f7e33d1

Browse files
committed
utils/annotate: "topology" location may be used to manipulate topo attributes
Signed-off-by: Brice Goglin <[email protected]>
1 parent 88a6c1d commit f7e33d1

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

utils/hwloc/hwloc-annotate.1in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,12 @@ This is specified by the \fImode\fR:
8080
.B info <name> <value>
8181
Specifies a new string info attribute whose name is \fIname\fR and
8282
value is \fIvalue\fR.
83+
8384
If \fBlocation\fR is \fIcpukind#<N>\fR, operate on the info attributes
8485
of the N-th cpukind.
86+
87+
If \fBlocation\fR is \fItopology\fR, operate on the topology info
88+
attributes instead of on objects.
8589
.TP
8690
.B subtype <subtype>
8791
Specifies that the subtype attribute of the object should now be \fIsubtype\fR.
@@ -228,6 +232,10 @@ Remove all info attributes from the first cpukind:
228232

229233
$ hwloc-annotate --ci input.xml output.xml -- cpukind#0 -- none
230234

235+
Add an info attribute to the topology:
236+
237+
$ hwloc-annotate input.xml output.xml -- topology -- info GotThisTopology FromMyGreatServerYesterday
238+
231239
Add a Misc object named "foobar" under the root object of the topology
232240
and modify the input XML directly:
233241

utils/hwloc/hwloc-annotate.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,8 @@ int main(int argc, char *argv[])
801801
} else {
802802
apply_infos(infos);
803803
}
804+
} else if (!strcmp(location, "topology") && (infoname || clearinfos)) {
805+
apply_infos(hwloc_topology_get_infos(topology));
804806
} else if (!strcmp(location, "all")) {
805807
apply_recursive(topology, hwloc_get_root_obj(topology));
806808
} else if (!strcmp(location, "root")) {

utils/hwloc/test-hwloc-annotate.output

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,5 @@
180180
<info name="foo" value="bar"/>
181181
<info name="foo2" value="bar2"/>
182182
</cpukind>
183+
<info name="Foooo" value="Barrr"/>
183184
</topology>

utils/hwloc/test-hwloc-annotate.sh.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ $annotate $srcdir/test-hwloc-annotate.input $file pu:0 misc pumisc
4646
$annotate $file $file root misc rootmisc
4747
$annotate $file $file misc:0 misc miscmisc1
4848
$annotate $file $file all info Foo Bar
49+
$annotate $file $file topology info Foooo Barrr
4950
$annotate --ci $file $file -- Core:all L3:all -- info Foo2 Bar2
5051
$annotate --ci $file $file L2Cache:0 none
5152
$annotate --ri $file $file pack:all info Foo

0 commit comments

Comments
 (0)