...
Source file src/pkg/cmd/vendor/github.com/google/pprof/internal/report/source_html.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package report
16
17 import (
18 "html/template"
19 )
20
21
22 func AddSourceTemplates(t *template.Template) {
23 template.Must(t.Parse(`{{define "weblistcss"}}` + weblistPageCSS + `{{end}}`))
24 template.Must(t.Parse(`{{define "weblistjs"}}` + weblistPageScript + `{{end}}`))
25 }
26
27 const weblistPageCSS = `<style type="text/css">
28 body {
29 font-family: sans-serif;
30 }
31 h1 {
32 font-size: 1.5em;
33 margin-bottom: 4px;
34 }
35 .legend {
36 font-size: 1.25em;
37 }
38 .line, .nop, .unimportant {
39 color: #aaaaaa;
40 }
41 .inlinesrc {
42 color: #000066;
43 }
44 .deadsrc {
45 cursor: pointer;
46 }
47 .deadsrc:hover {
48 background-color: #eeeeee;
49 }
50 .livesrc {
51 color: #0000ff;
52 cursor: pointer;
53 }
54 .livesrc:hover {
55 background-color: #eeeeee;
56 }
57 .asm {
58 color: #008800;
59 display: none;
60 }
61 </style>`
62
63 const weblistPageScript = `<script type="text/javascript">
64 function pprof_toggle_asm(e) {
65 var target;
66 if (!e) e = window.event;
67 if (e.target) target = e.target;
68 else if (e.srcElement) target = e.srcElement;
69
70 if (target) {
71 var asm = target.nextSibling;
72 if (asm && asm.className == "asm") {
73 asm.style.display = (asm.style.display == "block" ? "" : "block");
74 e.preventDefault();
75 return false;
76 }
77 }
78 }
79 </script>`
80
81 const weblistPageClosing = `
82 </body>
83 </html>
84 `
85
View as plain text