Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
7ec34b55
Kaydet (Commit)
7ec34b55
authored
Agu 09, 2002
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
A tool to transform gprof(1) output into HTML, so you can click on a
function name and go to the corresponding entry.
üst
ed2f725f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
0 deletions
+78
-0
gprof2html.py
Tools/scripts/gprof2html.py
+78
-0
No files found.
Tools/scripts/gprof2html.py
0 → 100755
Dosyayı görüntüle @
7ec34b55
#! /usr/bin/env python2.3
"""Transform gprof(1) output into useful HTML."""
import
re
,
os
,
sys
,
cgi
,
webbrowser
header
=
"""
\
<html>
<head>
<title>gprof output (
%
s)</title>
</head>
<body>
<pre>
"""
trailer
=
"""
\
</pre>
</body>
</html>
"""
def
add_escapes
(
input
):
for
line
in
input
:
yield
cgi
.
escape
(
line
)
def
main
():
filename
=
"gprof.out"
if
sys
.
argv
[
1
:]:
filename
=
sys
.
argv
[
1
]
outputfilename
=
filename
+
".html"
input
=
add_escapes
(
file
(
filename
))
output
=
file
(
outputfilename
,
"w"
)
output
.
write
(
header
%
filename
)
for
line
in
input
:
output
.
write
(
line
)
if
line
.
startswith
(
" time"
):
break
labels
=
{}
for
line
in
input
:
m
=
re
.
match
(
r"(.* )(\w+)\n"
,
line
)
if
not
m
:
output
.
write
(
line
)
break
stuff
,
fname
=
m
.
group
(
1
,
2
)
labels
[
fname
]
=
fname
output
.
write
(
'
%
s<a name="flat:
%
s" href="#call:
%
s">
%
s</a>
\n
'
%
(
stuff
,
fname
,
fname
,
fname
))
for
line
in
input
:
output
.
write
(
line
)
if
line
.
startswith
(
"index
%
time"
):
break
for
line
in
input
:
m
=
re
.
match
(
r"(.* )(\w+)(( <cycle.*>)? \[\d+\])\n"
,
line
)
if
not
m
:
output
.
write
(
line
)
if
line
.
startswith
(
"Index by function name"
):
break
continue
prefix
,
fname
,
suffix
=
m
.
group
(
1
,
2
,
3
)
if
fname
not
in
labels
:
output
.
write
(
line
)
continue
if
line
.
startswith
(
"["
):
output
.
write
(
'
%
s<a name="call:
%
s" href="#flat:
%
s">
%
s</a>
%
s
\n
'
%
(
prefix
,
fname
,
fname
,
fname
,
suffix
))
else
:
output
.
write
(
'
%
s<a href="#call:
%
s">
%
s</a>
%
s
\n
'
%
(
prefix
,
fname
,
fname
,
suffix
))
for
line
in
input
:
for
part
in
re
.
findall
(
r"(\w+(?:\.c)?|\W+)"
,
line
):
if
part
in
labels
:
part
=
'<a href="#call:
%
s">
%
s</a>'
%
(
part
,
part
)
output
.
write
(
part
)
output
.
write
(
trailer
)
output
.
close
()
webbrowser
.
open
(
"file:"
+
os
.
path
.
abspath
(
outputfilename
))
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment