MCPcopy Create free account
hub / github.com/apache/trafficserver / init

Method init

src/iocore/eventsystem/UnixEventProcessor.cc:227–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225
226#if TS_USE_HWLOC
227void
228ThreadAffinityInitializer::init()
229{
230 int affinity = 1;
231 REC_ReadConfigInteger(affinity, "proxy.config.exec_thread.affinity");
232
233 switch (affinity) {
234 case 4: // assign threads to logical processing units
235// Older versions of libhwloc (eg. Ubuntu 10.04) don't have HWLOC_OBJ_PU.
236#if HAVE_HWLOC_OBJ_PU
237 obj_type = HWLOC_OBJ_PU;
238 obj_name = "Logical Processor";
239 break;
240#endif
241
242 case 3: // assign threads to real cores
243 obj_type = HWLOC_OBJ_CORE;
244 obj_name = "Core";
245 break;
246
247 case 1: // assign threads to NUMA nodes (often 1:1 with sockets)
248 obj_type = HWLOC_OBJ_NODE;
249 obj_name = "NUMA Node";
250 if (hwloc_get_nbobjs_by_type(ink_get_topology(), obj_type) > 0) {
251 break;
252 }
253 // fallthrough
254
255 case 2: // assign threads to sockets
256 obj_type = HWLOC_OBJ_SOCKET;
257 obj_name = "Socket";
258 break;
259 default: // assign threads to the machine as a whole (a level below SYSTEM)
260 obj_type = HWLOC_OBJ_MACHINE;
261 obj_name = "Machine";
262 }
263
264 obj_count = hwloc_get_nbobjs_by_type(ink_get_topology(), obj_type);
265 Dbg(dbg_ctl_iocore_thread, "Affinity: %d %ss: %d PU: %d", affinity, obj_name, obj_count, ink_number_of_processors());
266}
267
268int
269ThreadAffinityInitializer::set_affinity(int, Event *)

Callers 4

initThreadStateMethod · 0.45
startMethod · 0.45
spawn_threadMethod · 0.45

Calls 2

ink_get_topologyFunction · 0.85
ink_number_of_processorsFunction · 0.85

Tested by

no test coverage detected