@@ -192,25 +192,28 @@ output_only (struct lstopo_output *loutput, hwloc_obj_t l)
192
192
{
193
193
FILE * output = loutput -> file ;
194
194
hwloc_obj_t child ;
195
- if (loutput -> show_only == l -> type ) {
196
- output_console_obj (loutput , l , 0 );
197
- fprintf (output , "\n" );
195
+ if (loutput -> show_only .type == l -> type
196
+ || loutput -> show_only .depth == l -> depth ) {
197
+ if (!hwloc_calc_check_object_filtered (l , & loutput -> show_only )) {
198
+ output_console_obj (loutput , l , 0 );
199
+ fprintf (output , "\n" );
200
+ }
198
201
}
199
202
/* there can be anything below normal children */
200
203
for_each_child (child , l )
201
204
output_only (loutput , child );
202
205
/* there can be only memory or Misc below memory children */
203
- if (hwloc_obj_type_is_memory (loutput -> show_only ) || loutput -> show_only == HWLOC_OBJ_MISC ) {
206
+ if (loutput -> show_only . type == HWLOC_OBJ_TYPE_NONE || hwloc_obj_type_is_memory (loutput -> show_only . type ) || loutput -> show_only . type == HWLOC_OBJ_MISC ) {
204
207
for (child = l -> memory_first_child ; child ; child = child -> next_sibling )
205
208
output_only (loutput , child );
206
209
}
207
210
/* there can be only I/O or Misc below I/O children */
208
- if (hwloc_obj_type_is_io (loutput -> show_only ) || loutput -> show_only == HWLOC_OBJ_MISC ) {
211
+ if (loutput -> show_only . type == HWLOC_OBJ_TYPE_NONE || hwloc_obj_type_is_io (loutput -> show_only . type ) || loutput -> show_only . type == HWLOC_OBJ_MISC ) {
209
212
for_each_io_child (child , l )
210
213
output_only (loutput , child );
211
214
}
212
215
/* there can be only Misc below Misc children */
213
- if (loutput -> show_only == HWLOC_OBJ_MISC ) {
216
+ if (loutput -> show_only . type == HWLOC_OBJ_TYPE_NONE || loutput -> show_only . type == HWLOC_OBJ_MISC ) {
214
217
/* Misc can only contain other Misc, no need to recurse otherwise */
215
218
for_each_misc_child (child , l )
216
219
output_only (loutput , child );
@@ -505,27 +508,31 @@ output_console(struct lstopo_output *loutput, const char *filename)
505
508
* if verbose_mode > 1, print both.
506
509
*/
507
510
508
- if (loutput -> show_only != HWLOC_OBJ_TYPE_NONE ) {
509
- if (verbose_mode > 1 )
510
- fprintf (output , "Only showing %s objects\n" , hwloc_obj_type_string (loutput -> show_only ));
511
+ if (loutput -> show_only .depth != HWLOC_TYPE_DEPTH_UNKNOWN ) {
512
+ if (verbose_mode > 1 ) {
513
+ if (loutput -> show_only .type != HWLOC_OBJ_TYPE_NONE )
514
+ fprintf (output , "Only showing some %s objects\n" , hwloc_obj_type_string (loutput -> show_only .type ));
515
+ else
516
+ fprintf (output , "Only showing some objects at depth %d\n" , loutput -> show_only .depth );
517
+ }
511
518
output_only (loutput , hwloc_get_root_obj (topology ));
512
519
} else if (verbose_mode >= 1 ) {
513
520
output_topology (loutput , hwloc_get_root_obj (topology ), NULL , 0 );
514
521
fprintf (output , "\n" );
515
522
}
516
523
517
- if ((verbose_mode > 1 || !verbose_mode ) && loutput -> show_only == HWLOC_OBJ_TYPE_NONE ) {
524
+ if ((verbose_mode > 1 || !verbose_mode ) && loutput -> show_only . depth == HWLOC_TYPE_DEPTH_UNKNOWN ) {
518
525
hwloc_lstopo_show_summary (output , topology );
519
526
}
520
527
521
- if (verbose_mode > 1 && loutput -> show_only == HWLOC_OBJ_TYPE_NONE ) {
528
+ if (verbose_mode > 1 && loutput -> show_only . depth == HWLOC_TYPE_DEPTH_UNKNOWN ) {
522
529
output_distances (loutput );
523
530
output_memattrs (loutput );
524
531
output_cpukinds (loutput );
525
532
output_windows_processor_groups (loutput , verbose_mode > 2 );
526
533
}
527
534
528
- if (verbose_mode > 1 && loutput -> show_only == HWLOC_OBJ_TYPE_NONE ) {
535
+ if (verbose_mode > 1 && loutput -> show_only . depth == HWLOC_TYPE_DEPTH_UNKNOWN ) {
529
536
hwloc_const_bitmap_t complete = hwloc_topology_get_complete_cpuset (topology );
530
537
hwloc_const_bitmap_t topo = hwloc_topology_get_topology_cpuset (topology );
531
538
hwloc_const_bitmap_t allowed = hwloc_topology_get_allowed_cpuset (topology );
0 commit comments