Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8af8b2b

Browse files
committed
Fix perf maps address format
1 parent4898415 commit8af8b2b

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

‎Lib/test/test_perf_profiler.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
importunittest
2+
importstring
23
importsubprocess
34
importsys
45
importsysconfig
@@ -70,9 +71,14 @@ def baz():
7071
perf_file=pathlib.Path(f"/tmp/perf-{process.pid}.map")
7172
self.assertTrue(perf_file.exists())
7273
perf_file_contents=perf_file.read_text()
73-
self.assertIn(f"py::foo:{script}",perf_file_contents)
74-
self.assertIn(f"py::bar:{script}",perf_file_contents)
75-
self.assertIn(f"py::baz:{script}",perf_file_contents)
74+
perf_lines=perf_file_contents.splitlines();
75+
expected_funcs= [f"py::foo:{script}",f"py::bar:{script}",f"py::baz:{script}"]
76+
forexpected_funcinexpected_funcs:
77+
perf_line=next((lineforlineinperf_linesifexpected_funcinline),None)
78+
self.assertIsNotNone(perf_line,f"Could not find{expected_func} in perf file")
79+
perf_addr=perf_line.split(" ")[0]
80+
self.assertFalse(perf_addr.startswith("0x"),"Address should not be prefixed with 0x")
81+
self.assertTrue(set(perf_addr).issubset(string.hexdigits),"Address should contain only hex characters")
7682

7783
deftest_trampoline_works_with_forks(self):
7884
code="""if 1:

‎Python/perf_trampoline.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ perf_map_write_entry(void *state, const void *code_addr,
253253
NULL);
254254
return;
255255
}
256-
fprintf(method_file,"%p %x py::%s:%s\n",code_addr,code_size,entry,
256+
fprintf(method_file,"%llx %x py::%s:%s\n",code_addr,code_size,entry,
257257
filename);
258258
fflush(method_file);
259259
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp