viztracer 1.1.0__cp314-cp314-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of viztracer might be problematic. Click here for more details.

Files changed (109) hide show
  1. viztracer/__init__.py +19 -0
  2. viztracer/__main__.py +8 -0
  3. viztracer/attach.py +67 -0
  4. viztracer/attach_process/LICENSE +203 -0
  5. viztracer/attach_process/__init__.py +0 -0
  6. viztracer/attach_process/add_code_to_python_process.py +582 -0
  7. viztracer/attach_process/attach_x86.dll +0 -0
  8. viztracer/attach_process/inject_dll_amd64.exe +0 -0
  9. viztracer/attach_process/linux_and_mac/lldb_prepare.py +54 -0
  10. viztracer/attach_process/run_code_on_dllmain_amd64.dll +0 -0
  11. viztracer/attach_process/run_code_on_dllmain_x86.dll +0 -0
  12. viztracer/cellmagic.py +70 -0
  13. viztracer/code_monkey.py +353 -0
  14. viztracer/decorator.py +164 -0
  15. viztracer/event_base.py +81 -0
  16. viztracer/functree.py +135 -0
  17. viztracer/html/flamegraph.html +34 -0
  18. viztracer/html/trace_viewer_embedder.html +203 -0
  19. viztracer/html/trace_viewer_full.html +10207 -0
  20. viztracer/main.py +699 -0
  21. viztracer/modules/eventnode.c +172 -0
  22. viztracer/modules/eventnode.h +73 -0
  23. viztracer/modules/pythoncapi_compat.h +1726 -0
  24. viztracer/modules/quicktime.c +177 -0
  25. viztracer/modules/quicktime.h +104 -0
  26. viztracer/modules/snaptrace.c +2205 -0
  27. viztracer/modules/snaptrace.h +134 -0
  28. viztracer/modules/snaptrace_member.c +483 -0
  29. viztracer/modules/util.c +45 -0
  30. viztracer/modules/util.h +22 -0
  31. viztracer/modules/vcompressor/vc_dump.c +1131 -0
  32. viztracer/modules/vcompressor/vc_dump.h +49 -0
  33. viztracer/modules/vcompressor/vcompressor.c +396 -0
  34. viztracer/modules/vcompressor/vcompressor.h +15 -0
  35. viztracer/patch.py +307 -0
  36. viztracer/report_builder.py +311 -0
  37. viztracer/snaptrace.cp314-win_amd64.pyd +0 -0
  38. viztracer/snaptrace.pyi +77 -0
  39. viztracer/util.py +196 -0
  40. viztracer/vcompressor.cp314-win_amd64.pyd +0 -0
  41. viztracer/vcompressor.pyi +10 -0
  42. viztracer/viewer.py +528 -0
  43. viztracer/vizcounter.py +20 -0
  44. viztracer/vizevent.py +31 -0
  45. viztracer/vizlogging.py +20 -0
  46. viztracer/vizobject.py +28 -0
  47. viztracer/vizplugin.py +143 -0
  48. viztracer/viztracer.py +472 -0
  49. viztracer/web_dist/LICENSE +189 -0
  50. viztracer/web_dist/index.html +127 -0
  51. viztracer/web_dist/service_worker.js +279 -0
  52. viztracer/web_dist/trace_processor +300 -0
  53. viztracer/web_dist/v52.0-6b9586def/assets/MaterialSymbolsOutlined.woff2 +0 -0
  54. viztracer/web_dist/v52.0-6b9586def/assets/Roboto-100.woff2 +0 -0
  55. viztracer/web_dist/v52.0-6b9586def/assets/Roboto-300.woff2 +0 -0
  56. viztracer/web_dist/v52.0-6b9586def/assets/Roboto-400.woff2 +0 -0
  57. viztracer/web_dist/v52.0-6b9586def/assets/Roboto-500.woff2 +0 -0
  58. viztracer/web_dist/v52.0-6b9586def/assets/RobotoCondensed-Light.woff2 +0 -0
  59. viztracer/web_dist/v52.0-6b9586def/assets/RobotoCondensed-Regular.woff2 +0 -0
  60. viztracer/web_dist/v52.0-6b9586def/assets/RobotoMono-Regular.woff2 +0 -0
  61. viztracer/web_dist/v52.0-6b9586def/assets/brand.png +0 -0
  62. viztracer/web_dist/v52.0-6b9586def/assets/catapult_trace_viewer.html +3946 -0
  63. viztracer/web_dist/v52.0-6b9586def/assets/catapult_trace_viewer.js +7539 -0
  64. viztracer/web_dist/v52.0-6b9586def/assets/favicon.png +0 -0
  65. viztracer/web_dist/v52.0-6b9586def/assets/logo-128.png +0 -0
  66. viztracer/web_dist/v52.0-6b9586def/assets/logo-3d.png +0 -0
  67. viztracer/web_dist/v52.0-6b9586def/assets/rec_atrace.png +0 -0
  68. viztracer/web_dist/v52.0-6b9586def/assets/rec_battery_counters.png +0 -0
  69. viztracer/web_dist/v52.0-6b9586def/assets/rec_board_voltage.png +0 -0
  70. viztracer/web_dist/v52.0-6b9586def/assets/rec_cpu_coarse.png +0 -0
  71. viztracer/web_dist/v52.0-6b9586def/assets/rec_cpu_fine.png +0 -0
  72. viztracer/web_dist/v52.0-6b9586def/assets/rec_cpu_freq.png +0 -0
  73. viztracer/web_dist/v52.0-6b9586def/assets/rec_cpu_voltage.png +0 -0
  74. viztracer/web_dist/v52.0-6b9586def/assets/rec_frame_timeline.png +0 -0
  75. viztracer/web_dist/v52.0-6b9586def/assets/rec_ftrace.png +0 -0
  76. viztracer/web_dist/v52.0-6b9586def/assets/rec_gpu_mem_total.png +0 -0
  77. viztracer/web_dist/v52.0-6b9586def/assets/rec_java_heap_dump.png +0 -0
  78. viztracer/web_dist/v52.0-6b9586def/assets/rec_lmk.png +0 -0
  79. viztracer/web_dist/v52.0-6b9586def/assets/rec_logcat.png +0 -0
  80. viztracer/web_dist/v52.0-6b9586def/assets/rec_long_trace.png +0 -0
  81. viztracer/web_dist/v52.0-6b9586def/assets/rec_mem_hifreq.png +0 -0
  82. viztracer/web_dist/v52.0-6b9586def/assets/rec_meminfo.png +0 -0
  83. viztracer/web_dist/v52.0-6b9586def/assets/rec_native_heap_profiler.png +0 -0
  84. viztracer/web_dist/v52.0-6b9586def/assets/rec_one_shot.png +0 -0
  85. viztracer/web_dist/v52.0-6b9586def/assets/rec_profiling.png +0 -0
  86. viztracer/web_dist/v52.0-6b9586def/assets/rec_ps_stats.png +0 -0
  87. viztracer/web_dist/v52.0-6b9586def/assets/rec_ring_buf.png +0 -0
  88. viztracer/web_dist/v52.0-6b9586def/assets/rec_syscalls.png +0 -0
  89. viztracer/web_dist/v52.0-6b9586def/assets/rec_vmstat.png +0 -0
  90. viztracer/web_dist/v52.0-6b9586def/assets/scheduling_latency.png +0 -0
  91. viztracer/web_dist/v52.0-6b9586def/assets/vscode-icon.png +0 -0
  92. viztracer/web_dist/v52.0-6b9586def/engine_bundle.js +3 -0
  93. viztracer/web_dist/v52.0-6b9586def/frontend_bundle.js +5495 -0
  94. viztracer/web_dist/v52.0-6b9586def/index.html +127 -0
  95. viztracer/web_dist/v52.0-6b9586def/manifest.json +52 -0
  96. viztracer/web_dist/v52.0-6b9586def/perfetto.css +5737 -0
  97. viztracer/web_dist/v52.0-6b9586def/stdlib_docs.json +1 -0
  98. viztracer/web_dist/v52.0-6b9586def/trace_config_utils.wasm +0 -0
  99. viztracer/web_dist/v52.0-6b9586def/trace_processor.wasm +0 -0
  100. viztracer/web_dist/v52.0-6b9586def/trace_processor_memory64.wasm +0 -0
  101. viztracer/web_dist/v52.0-6b9586def/traceconv.wasm +0 -0
  102. viztracer/web_dist/v52.0-6b9586def/traceconv_bundle.js +2 -0
  103. viztracer-1.1.0.dist-info/METADATA +316 -0
  104. viztracer-1.1.0.dist-info/RECORD +109 -0
  105. viztracer-1.1.0.dist-info/WHEEL +5 -0
  106. viztracer-1.1.0.dist-info/entry_points.txt +3 -0
  107. viztracer-1.1.0.dist-info/licenses/LICENSE +222 -0
  108. viztracer-1.1.0.dist-info/licenses/NOTICE.txt +27 -0
  109. viztracer-1.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,300 @@
1
+ #!/usr/bin/env python3
2
+ # Copyright (C) 2021 The Android Open Source Project
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
17
+ # DO NOT EDIT. Auto-generated by tools/gen_amalgamated_python_tools
18
+ # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
19
+
20
+ # This file should do the same thing when being invoked in any of these ways:
21
+ # ./trace_processor
22
+ # python trace_processor
23
+ # bash trace_processor
24
+ # cat ./trace_processor | bash
25
+ # cat ./trace_processor | python -
26
+
27
+ BASH_FALLBACK=""" "
28
+ exec python3 - "$@" <<'#'EOF
29
+ #""" # yapf: disable
30
+
31
+
32
+ # ----- Amalgamator: begin of python/perfetto/prebuilts/manifests/trace_processor_shell.py
33
+ # This file has been generated by: tools/roll-prebuilts v52.0
34
+ TRACE_PROCESSOR_SHELL_MANIFEST = [{
35
+ 'arch':
36
+ 'mac-amd64',
37
+ 'file_name':
38
+ 'trace_processor_shell',
39
+ 'file_size':
40
+ 11378016,
41
+ 'url':
42
+ 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v52.0/mac-amd64/trace_processor_shell',
43
+ 'sha256':
44
+ '0ce16fc3e2add79cd66c6596a04ec61eb3b2b8d5507496c5d325f57cb89dc5e8',
45
+ 'platform':
46
+ 'darwin',
47
+ 'machine': ['x86_64']
48
+ }, {
49
+ 'arch':
50
+ 'mac-arm64',
51
+ 'file_name':
52
+ 'trace_processor_shell',
53
+ 'file_size':
54
+ 10561528,
55
+ 'url':
56
+ 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v52.0/mac-arm64/trace_processor_shell',
57
+ 'sha256':
58
+ '5d7d89fb2472c2ef40413141d5e8f3603d4a500a645d35aa57cb023b9d635b31',
59
+ 'platform':
60
+ 'darwin',
61
+ 'machine': ['arm64']
62
+ }, {
63
+ 'arch':
64
+ 'linux-amd64',
65
+ 'file_name':
66
+ 'trace_processor_shell',
67
+ 'file_size':
68
+ 11599408,
69
+ 'url':
70
+ 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v52.0/linux-amd64/trace_processor_shell',
71
+ 'sha256':
72
+ '411402424f34f2ac1fafa819493c13827ae5a10e335d9387a483c4b696b7f6e1',
73
+ 'platform':
74
+ 'linux',
75
+ 'machine': ['x86_64']
76
+ }, {
77
+ 'arch':
78
+ 'linux-arm',
79
+ 'file_name':
80
+ 'trace_processor_shell',
81
+ 'file_size':
82
+ 8656808,
83
+ 'url':
84
+ 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v52.0/linux-arm/trace_processor_shell',
85
+ 'sha256':
86
+ 'e45b30a268e2a68f528cb181414383a02317b0e9ab530edb72041faf9fa60468',
87
+ 'platform':
88
+ 'linux',
89
+ 'machine': ['armv6l', 'armv7l', 'armv8l']
90
+ }, {
91
+ 'arch':
92
+ 'linux-arm64',
93
+ 'file_name':
94
+ 'trace_processor_shell',
95
+ 'file_size':
96
+ 11055208,
97
+ 'url':
98
+ 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v52.0/linux-arm64/trace_processor_shell',
99
+ 'sha256':
100
+ 'e52888ab9b7d4f3d2620a6f803402e60a11230536d048d0ece4f33b78dd7c368',
101
+ 'platform':
102
+ 'linux',
103
+ 'machine': ['aarch64']
104
+ }, {
105
+ 'arch':
106
+ 'android-arm',
107
+ 'file_name':
108
+ 'trace_processor_shell',
109
+ 'file_size':
110
+ 8691452,
111
+ 'url':
112
+ 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v52.0/android-arm/trace_processor_shell',
113
+ 'sha256':
114
+ '2d5881d738d086296dcb5a82a56eb94860ba1b6b41f11f0e48aeff26b63be406'
115
+ }, {
116
+ 'arch':
117
+ 'android-arm64',
118
+ 'file_name':
119
+ 'trace_processor_shell',
120
+ 'file_size':
121
+ 10966008,
122
+ 'url':
123
+ 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v52.0/android-arm64/trace_processor_shell',
124
+ 'sha256':
125
+ '6c76a80e4dbf5f6b58905da995111b659c573bd3a100f683c046dd7854a2179a'
126
+ }, {
127
+ 'arch':
128
+ 'android-x86',
129
+ 'file_name':
130
+ 'trace_processor_shell',
131
+ 'file_size':
132
+ 12232376,
133
+ 'url':
134
+ 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v52.0/android-x86/trace_processor_shell',
135
+ 'sha256':
136
+ '135e557cedcec6cd580aafc1a74cac974da0811f56fd724d61e60b575f772193'
137
+ }, {
138
+ 'arch':
139
+ 'android-x64',
140
+ 'file_name':
141
+ 'trace_processor_shell',
142
+ 'file_size':
143
+ 11432000,
144
+ 'url':
145
+ 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v52.0/android-x64/trace_processor_shell',
146
+ 'sha256':
147
+ '634ecc32a0055c805ac62aab77bdf040daed3f5f148064f3e252912705eb3f6d'
148
+ }, {
149
+ 'arch':
150
+ 'windows-amd64',
151
+ 'file_name':
152
+ 'trace_processor_shell.exe',
153
+ 'file_size':
154
+ 11401216,
155
+ 'url':
156
+ 'https://commondatastorage.googleapis.com/perfetto-luci-artifacts/v52.0/windows-amd64/trace_processor_shell.exe',
157
+ 'sha256':
158
+ 'e46f58f5158b48508389e096aa3d5cf7b510b9767a89f949e423abe8c09ca380',
159
+ 'platform':
160
+ 'win32',
161
+ 'machine': ['amd64']
162
+ }]
163
+
164
+ # ----- Amalgamator: end of python/perfetto/prebuilts/manifests/trace_processor_shell.py
165
+
166
+ # ----- Amalgamator: begin of python/perfetto/prebuilts/perfetto_prebuilts.py
167
+ # Copyright (C) 2021 The Android Open Source Project
168
+ #
169
+ # Licensed under the Apache License, Version 2.0 (the "License");
170
+ # you may not use this file except in compliance with the License.
171
+ # You may obtain a copy of the License at
172
+ #
173
+ # http://www.apache.org/licenses/LICENSE-2.0
174
+ #
175
+ # Unless required by applicable law or agreed to in writing, software
176
+ # distributed under the License is distributed on an "AS IS" BASIS,
177
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
178
+ # See the License for the specific language governing permissions and
179
+ # limitations under the License.
180
+ """
181
+ Functions to fetch pre-pinned Perfetto prebuilts.
182
+
183
+ This function is used in different places:
184
+ - Into the //tools/{trace_processor, traceconv} scripts, which are just plain
185
+ wrappers around executables.
186
+ - Into the //tools/{heap_profiler, record_android_trace} scripts, which contain
187
+ some other hand-written python code.
188
+
189
+ The manifest argument looks as follows:
190
+ TRACECONV_MANIFEST = [
191
+ {
192
+ 'arch': 'mac-amd64',
193
+ 'file_name': 'traceconv',
194
+ 'file_size': 7087080,
195
+ 'url': https://commondatastorage.googleapis.com/.../trace_to_text',
196
+ 'sha256': 7d957c005b0dc130f5bd855d6cec27e060d38841b320d04840afc569f9087490',
197
+ 'platform': 'darwin',
198
+ 'machine': 'x86_64'
199
+ },
200
+ ...
201
+ ]
202
+
203
+ The intended usage is:
204
+
205
+ from perfetto.prebuilts.manifests.traceconv import TRACECONV_MANIFEST
206
+ bin_path = get_perfetto_prebuilt(TRACECONV_MANIFEST)
207
+ subprocess.call(bin_path, ...)
208
+ """
209
+
210
+ import hashlib
211
+ import os
212
+ import platform
213
+ import random
214
+ import subprocess
215
+ import sys
216
+
217
+
218
+ def download_or_get_cached(file_name, url, sha256):
219
+ """ Downloads a prebuilt or returns a cached version
220
+
221
+ The first time this is invoked, it downloads the |url| and caches it into
222
+ ~/.local/share/perfetto/prebuilts/$tool_name. On subsequent invocations it
223
+ just runs the cached version.
224
+ """
225
+ dir = os.path.join(
226
+ os.path.expanduser('~'), '.local', 'share', 'perfetto', 'prebuilts')
227
+ os.makedirs(dir, exist_ok=True)
228
+ bin_path = os.path.join(dir, file_name)
229
+ sha256_path = os.path.join(dir, file_name + '.sha256')
230
+ needs_download = True
231
+
232
+ # Avoid recomputing the SHA-256 on each invocation. The SHA-256 of the last
233
+ # download is cached into file_name.sha256, just check if that matches.
234
+ if os.path.exists(bin_path) and os.path.exists(sha256_path):
235
+ with open(sha256_path, 'rb') as f:
236
+ digest = f.read().decode()
237
+ if digest == sha256:
238
+ needs_download = False
239
+
240
+ if needs_download: # The file doesn't exist or the SHA256 doesn't match.
241
+ # Use a unique random file to guard against concurrent executions.
242
+ # See https://github.com/google/perfetto/issues/786 .
243
+ tmp_path = '%s.%d.tmp' % (bin_path, random.randint(0, 100000))
244
+ print('Downloading ' + url)
245
+ subprocess.check_call(['curl', '-f', '-L', '-#', '-o', tmp_path, url])
246
+ with open(tmp_path, 'rb') as fd:
247
+ actual_sha256 = hashlib.sha256(fd.read()).hexdigest()
248
+ if actual_sha256 != sha256:
249
+ raise Exception('Checksum mismatch for %s (actual: %s, expected: %s)' %
250
+ (url, actual_sha256, sha256))
251
+ os.chmod(tmp_path, 0o755)
252
+ os.replace(tmp_path, bin_path)
253
+ with open(tmp_path, 'w') as f:
254
+ f.write(sha256)
255
+ os.replace(tmp_path, sha256_path)
256
+ return bin_path
257
+
258
+
259
+ def get_perfetto_prebuilt(manifest, soft_fail=False, arch=None):
260
+ """ Downloads the prebuilt, if necessary, and returns its path on disk. """
261
+ plat = sys.platform.lower()
262
+ machine = platform.machine().lower()
263
+ manifest_entry = None
264
+ for entry in manifest:
265
+ # If the caller overrides the arch, just match that (for Android prebuilts).
266
+ if arch:
267
+ if entry.get('arch') == arch:
268
+ manifest_entry = entry
269
+ break
270
+ continue
271
+ # Otherwise guess the local machine arch.
272
+ if entry.get('platform') == plat and machine in entry.get('machine', []):
273
+ manifest_entry = entry
274
+ break
275
+ if manifest_entry is None:
276
+ if soft_fail:
277
+ return None
278
+ raise Exception(
279
+ ('No prebuilts available for %s-%s\n' % (plat, machine)) +
280
+ 'See https://perfetto.dev/docs/contributing/build-instructions')
281
+
282
+ return download_or_get_cached(
283
+ file_name=manifest_entry['file_name'],
284
+ url=manifest_entry['url'],
285
+ sha256=manifest_entry['sha256'])
286
+
287
+
288
+ def run_perfetto_prebuilt(manifest):
289
+ bin_path = get_perfetto_prebuilt(manifest)
290
+ if sys.platform.lower() == 'win32':
291
+ sys.exit(subprocess.check_call([bin_path, *sys.argv[1:]]))
292
+ os.execv(bin_path, [bin_path] + sys.argv[1:])
293
+
294
+
295
+ # ----- Amalgamator: end of python/perfetto/prebuilts/perfetto_prebuilts.py
296
+
297
+ if __name__ == '__main__':
298
+ run_perfetto_prebuilt(TRACE_PROCESSOR_SHELL_MANIFEST)
299
+
300
+ #EOF