@@ -78,7 +78,7 @@ FILE *open_output(const char *filename, int overwrite)
7878 return fopen (filename , "w" );
7979}
8080
81- static hwloc_obj_t insert_task (hwloc_topology_t topology , hwloc_cpuset_t cpuset , const char * name , int thread )
81+ static hwloc_obj_t insert_misc (hwloc_topology_t topology , hwloc_cpuset_t cpuset , const char * subtype , const char * name )
8282{
8383 hwloc_obj_t group , obj ;
8484
@@ -99,16 +99,16 @@ static hwloc_obj_t insert_task(hwloc_topology_t topology, hwloc_cpuset_t cpuset,
9999 hwloc_bitmap_asprintf (& s , cpuset );
100100 group = hwloc_get_obj_covering_cpuset (topology , cpuset );
101101 hwloc_bitmap_asprintf (& gs , group -> cpuset );
102- fprintf (stderr , "%s `%s' binding %s doesn't match any object, extended to %s before inserting the %s in the topology .\n" ,
103- thread ? "Thread" : "Process" , name , s , gs , thread ? "thread" : "process" );
102+ fprintf (stderr , "%s `%s' binding %s doesn't match any object, extended to %s before inserting the object .\n" ,
103+ subtype , name , s , gs );
104104 free (s );
105105 free (gs );
106106 }
107107 obj = hwloc_topology_insert_misc_object (topology , group , name );
108108 if (!obj )
109109 fprintf (stderr , "Failed to insert process `%s'\n" , name );
110- else
111- obj -> subtype = strdup ("Process" );
110+ else if ( subtype )
111+ obj -> subtype = strdup (subtype );
112112
113113 return obj ;
114114}
@@ -125,7 +125,7 @@ static void foreach_process_cb(hwloc_topology_t topology,
125125 snprintf (name , sizeof (name ), "%ld %s" , proc -> pid , proc -> name );
126126
127127 if (proc -> bound )
128- insert_task (topology , proc -> cpuset , name , 0 );
128+ insert_misc (topology , proc -> cpuset , "Process" , name );
129129
130130 if (proc -> nthreads )
131131 for (i = 0 ; i < proc -> nthreads ; i ++ )
@@ -137,7 +137,7 @@ static void foreach_process_cb(hwloc_topology_t topology,
137137 else
138138 snprintf (task_name , sizeof (task_name ), "%s %li" , name , proc -> threads [i ].tid );
139139
140- insert_task (topology , proc -> threads [i ].cpuset , task_name , 1 );
140+ insert_misc (topology , proc -> threads [i ].cpuset , "Thread" , task_name );
141141 }
142142}
143143
0 commit comments