Commit 444b531
Refactor/decouple drogon remove singleton (#35)
* refactor: decouple Drogon/spdlog, remove singletons (WIP)
- Remove spdlog dependency: DefaultLogSink now uses std::cout/std::cerr
- Replace spdlog/fmt with C++20 std::format in log macros
- Add HttpServer abstraction interface (include/profiler/http_server.h)
- Remove singleton from LogManager, make it instance-owned
- Update log macros to use log_manager_ member instead of global singleton
- Update plan.md with full design document for the refactoring
Still TODO: ProfilerManager singleton removal, Drogon adapter,
web_server refactoring, CMake target split, example/test updates
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* docs: add detailed progress tracking and continuation guide
Record completed tasks (spdlog removal, HttpServer interface,
LogManager de-singleton) and remaining tasks with specific
file-level change instructions for next development session.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: decouple Drogon, remove singleton, split CMake targets
- Remove ProfilerManager singleton: delete getInstance(), make constructor
public, use unique_ptr<LogManager> (PIMPL) for per-instance log config
- Create HttpServer abstraction: pure C++ interface (Request/Response structs)
in include/profiler/http_server.h, no framework dependency
- Create Drogon adapter: src/backends/drogon/drogon_http_server.{h,cpp}
implements HttpServer interface, only place that #includes <drogon/drogon.h>
- Rewrite web_server.cpp: all routes use HttpServer abstraction instead of
Drogon directly, remove Json::Value dependency (manual JSON string building)
- Remove spdlog dependency: DefaultLogSink uses std::cout/std::cerr,
log macros use std::format instead of fmt
- Split CMake targets: profiler_core (no Drogon) + profiler_web (optional,
requires Drogon), add REMOTE_PROFILER_ENABLE_WEB option
- Update logger.h: global setSink/setLogLevel removed, now ProfilerManager
instance methods
- Signal handler: lazy install on first captureAllThreadStacks() call
- Update example and tests for non-singleton API
- Remove spdlog from vcpkg.json
All 18 tests pass (LoggerTest: 7, FullFlowTest: 6, CPUProfileTest: 5).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: replace HttpServer abstraction with ProfilerHttpHandlers
Replace the HttpServer interface pattern with a simpler, more flexible
design: ProfilerHttpHandlers provides framework-agnostic handler methods
that return HandlerResponse structs. Users with any web framework can
call handlers and wrap responses with their own request/response types.
- Add include/profiler/http_handlers.h (HandlerResponse + ProfilerHttpHandlers)
- Add src/http_handlers.cpp (all profiler endpoint business logic)
- Simplify web_server.cpp to a thin Drogon adapter
- Delete include/profiler/http_server.h and src/backends/drogon/
- Update example to use registerHttpHandlers(profiler) directly
- Move page handlers (WebResources) to profiler_web, data handlers to profiler_core
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: suppress unused parameter warning in DefaultLogSink
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update user guides for non-singleton ProfilerHttpHandlers API
- Replace all getInstance() singleton references with local instances
- Add ProfilerHttpHandlers and HandlerResponse API documentation
- Add integration examples for any web framework (not just Drogon)
- Update setSink/setLogLevel as ProfilerManager instance methods
- Remove spdlog references (now uses std::cout/cerr)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* style: apply clang-format 18 to fix CI format check
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: rename web_server to drogon_adapter, fix outdated docs
- Rename web_server.h/cpp → profiler/drogon_adapter.h/src/drogon_adapter.cpp
- Rename registerHttpHandlers() → registerDrogonHandlers()
- Fix all getInstance() references in docs/examples → instance creation
- Fix profiler_lib references → profiler_core
- Update log_sink.h doc example to use instance method
- Update plan.md: remove outdated HttpServer/singleton/spdlog descriptions
- Update CMakeLists.txt install target for new header path
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: resolve CI format check and pmf-conversions warning
- Fix test_cpu_profile.cpp: replace member function pointer cast with
free function pointer (avoids -Werror=pmf-conversions)
- Apply clang-format-18 to profiler_manager.h/cpp, log_macros.h
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent 1733427 commit 444b531
29 files changed
Lines changed: 2097 additions & 2808 deletions
File tree
- docs/user_guide
- example
- include
- profiler
- src
- internal
- tests
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 46 | + | |
52 | 47 | | |
53 | 48 | | |
54 | 49 | | |
55 | 50 | | |
56 | 51 | | |
57 | 52 | | |
58 | | - | |
59 | | - | |
| 53 | + | |
60 | 54 | | |
61 | 55 | | |
62 | 56 | | |
| |||
82 | 76 | | |
83 | 77 | | |
84 | 78 | | |
85 | | - | |
| 79 | + | |
| 80 | + | |
86 | 81 | | |
87 | 82 | | |
88 | 83 | | |
| |||
108 | 103 | | |
109 | 104 | | |
110 | 105 | | |
111 | | - | |
112 | | - | |
113 | 106 | | |
114 | 107 | | |
115 | 108 | | |
116 | 109 | | |
117 | 110 | | |
118 | 111 | | |
119 | 112 | | |
120 | | - | |
121 | | - | |
122 | | - | |
| 113 | + | |
| 114 | + | |
123 | 115 | | |
124 | 116 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
| 117 | + | |
136 | 118 | | |
137 | 119 | | |
138 | 120 | | |
139 | 121 | | |
140 | 122 | | |
141 | | - | |
142 | 123 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
| 124 | + | |
148 | 125 | | |
149 | | - | |
150 | | - | |
151 | 126 | | |
152 | 127 | | |
153 | 128 | | |
| |||
164 | 139 | | |
165 | 140 | | |
166 | 141 | | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | 142 | | |
173 | 143 | | |
174 | 144 | | |
175 | 145 | | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | 146 | | |
195 | 147 | | |
196 | | - | |
| 148 | + | |
197 | 149 | | |
198 | 150 | | |
199 | 151 | | |
| 152 | + | |
200 | 153 | | |
201 | 154 | | |
202 | | - | |
| 155 | + | |
203 | 156 | | |
204 | 157 | | |
205 | 158 | | |
| |||
209 | 162 | | |
210 | 163 | | |
211 | 164 | | |
212 | | - | |
213 | | - | |
214 | 165 | | |
215 | 166 | | |
216 | 167 | | |
217 | 168 | | |
218 | 169 | | |
219 | 170 | | |
220 | | - | |
| 171 | + | |
221 | 172 | | |
222 | 173 | | |
223 | | - | |
224 | 174 | | |
225 | | - | |
| 175 | + | |
| 176 | + | |
226 | 177 | | |
227 | 178 | | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
| 179 | + | |
233 | 180 | | |
234 | | - | |
235 | | - | |
236 | | - | |
| 181 | + | |
| 182 | + | |
237 | 183 | | |
238 | 184 | | |
239 | | - | |
| 185 | + | |
240 | 186 | | |
241 | 187 | | |
242 | 188 | | |
243 | 189 | | |
244 | 190 | | |
245 | | - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
246 | 224 | | |
247 | 225 | | |
248 | 226 | | |
| |||
256 | 234 | | |
257 | 235 | | |
258 | 236 | | |
259 | | - | |
| 237 | + | |
260 | 238 | | |
261 | | - | |
262 | 239 | | |
263 | 240 | | |
264 | 241 | | |
265 | 242 | | |
266 | 243 | | |
267 | | - | |
268 | 244 | | |
269 | 245 | | |
270 | 246 | | |
| |||
286 | 262 | | |
287 | 263 | | |
288 | 264 | | |
289 | | - | |
290 | | - | |
291 | | - | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
292 | 268 | | |
293 | 269 | | |
294 | 270 | | |
| |||
307 | 283 | | |
308 | 284 | | |
309 | 285 | | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
| 286 | + | |
| 287 | + | |
0 commit comments