MCPcopy Create free account
hub / github.com/MemNixFS/MemNixFS / format_proc_threads

Function format_proc_threads

src/os/linux/threads.cpp:104–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104ByteBuf format_proc_threads(const Engine& eng, const Process& leader) {
105 auto threads = enumerate_threads(eng, leader);
106 std::string out;
107 out.reserve(2 * 1024);
108 out += fmt::format(
109 "# /proc/{}/threads.txt — threads of pid {} ({})\n"
110 "# Walks leader.signal->thread_head; tgid for all entries == {}.\n"
111 "# {} thread(s) total (incl. leader).\n"
112 "#\n"
113 "# TID state comm task_va\n"
114 "# ------- --------------------- --------------------- -------------------\n",
115 leader.pid, leader.pid, leader.comm, leader.tgid, threads.size());
116 for (const auto& t : threads) {
117 out += fmt::format(" {:>6} {:<22} {:<22} {:#018x}\n",
118 t.pid, state_name(t.state), t.comm, t.task_va);
119 }
120 return ByteBuf(out.begin(), out.end());
121}
122
123ByteBuf format_global_threads(const Engine& eng) {
124 std::string out;

Callers 1

build_proc_treeFunction · 0.85

Calls 3

enumerate_threadsFunction · 0.85
state_nameFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected