@@ -149,7 +149,6 @@ async fn handle_request(
149149 info ! ( "Starting CPU profile for {} seconds" , duration) ;
150150 handle_cpu_profile ( duration) . await
151151 }
152- ( & Method :: GET , "/" | "/debug/pprof" ) => handle_index ( ) . await ,
153152 _ => {
154153 warn ! ( "Not found: {} {}" , req. method( ) , req. uri( ) . path( ) ) ;
155154 Ok ( Response :: builder ( )
@@ -242,49 +241,6 @@ async fn handle_cpu_profile(duration_secs: u64) -> Result<Response<Full<Bytes>>,
242241 }
243242}
244243
245- /// Handle index/help page requests
246- async fn handle_index ( ) -> Result < Response < Full < Bytes > > , hyper:: Error > {
247- let body = r#"<!DOCTYPE html>
248- <html>
249- <head>
250- <title>pprof</title>
251- </head>
252- <body>
253- <h1>pprof - Performance Profiling</h1>
254- <p>Available endpoints:</p>
255- <ul>
256- <li><a href="/debug/pprof/profile?seconds=30">/debug/pprof/profile?seconds=30</a> - CPU profile (30 seconds)</li>
257- <li><a href="/debug/pprof/profile?seconds=60">/debug/pprof/profile?seconds=60</a> - CPU profile (60 seconds)</li>
258- </ul>
259-
260- <h2>Usage Examples</h2>
261- <pre>
262- # Collect CPU profile
263- curl http://localhost:6060/debug/pprof/profile?seconds=30 -o cpu.pb
264-
265- # Analyze with Go pprof
266- go tool pprof -http=:8080 cpu.pb
267-
268- # Generate flamegraph
269- pprof -flame cpu.pb > flamegraph.svg
270- </pre>
271-
272- <h2>Documentation</h2>
273- <p>
274- This service uses <a href="https://github.com/tikv/pprof-rs">pprof-rs</a> for performance profiling.
275- The output is compatible with Google's pprof format and can be analyzed using various tools.
276- </p>
277- </body>
278- </html>
279- "# ;
280-
281- Ok ( Response :: builder ( )
282- . status ( StatusCode :: OK )
283- . header ( "Content-Type" , "text/html; charset=utf-8" )
284- . body ( Full :: new ( Bytes :: from ( body) ) )
285- . unwrap ( ) )
286- }
287-
288244#[ cfg( test) ]
289245mod tests {
290246 use super :: * ;
0 commit comments