viztracer 1.1.0__cp312-cp312-macosx_11_0_x86_64.whl → 1.1.1__cp312-cp312-macosx_11_0_x86_64.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.
viztracer/__init__.py CHANGED
@@ -1,7 +1,7 @@
1
1
  # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
2
2
  # For details: https://github.com/gaogaotiantian/viztracer/blob/master/NOTICE.txt
3
3
 
4
- __version__ = "1.1.0"
4
+ __version__ = "1.1.1"
5
5
 
6
6
 
7
7
  from .cellmagic import load_ipython_extension
viztracer/main.py CHANGED
@@ -228,6 +228,8 @@ class VizUI:
228
228
  exec_name = command[0]
229
229
  self.ofile = unique_file_name(exec_name)
230
230
  if options.output_file:
231
+ if not options.compress and not options.output_file.endswith((".json", ".html", ".gz")):
232
+ return False, "Only html, json and gz are supported"
231
233
  self.ofile = options.output_file
232
234
  elif options.pid_suffix:
233
235
  self.ofile = "result.json"
@@ -130,12 +130,24 @@ fprintfeename(FILE* fptr, struct EventNode* node, uint8_t sanitize_function_name
130
130
  {
131
131
  if (node->data.fee.type == PyTrace_CALL || node->data.fee.type == PyTrace_RETURN) {
132
132
  #if PY_VERSION_HEX >= 0x030B0000
133
+ if (PyUnicode_Check(node->data.fee.code->co_qualname)) {
133
134
  fputs(PyUnicode_AsUTF8(node->data.fee.code->co_qualname), fptr);
135
+ } else {
136
+ fputs("<unknown>", fptr);
137
+ }
134
138
  #else
139
+ if (PyUnicode_Check(node->data.fee.code->co_name)) {
135
140
  fputs(PyUnicode_AsUTF8(node->data.fee.code->co_name), fptr);
141
+ } else {
142
+ fputs("<unknown>", fptr);
143
+ }
136
144
  #endif
137
145
  fputs(" (", fptr);
138
- fputs_escape(PyUnicode_AsUTF8(node->data.fee.code->co_filename), fptr);
146
+ if (PyUnicode_Check(node->data.fee.code->co_filename)) {
147
+ fputs_escape(PyUnicode_AsUTF8(node->data.fee.code->co_filename), fptr);
148
+ } else {
149
+ fputs("<unknown>", fptr);
150
+ }
139
151
  fprintf(fptr, ":%d)", node->data.fee.code->co_firstlineno);
140
152
  } else {
141
153
  const char* ml_name = node->data.fee.ml_name;
@@ -152,7 +164,11 @@ fprintfeename(FILE* fptr, struct EventNode* node, uint8_t sanitize_function_name
152
164
  }
153
165
  if (node->data.fee.m_module) {
154
166
  // The function belongs to a module
155
- fputs(PyUnicode_AsUTF8(node->data.fee.m_module), fptr);
167
+ if (PyUnicode_Check(node->data.fee.m_module)) {
168
+ fputs(PyUnicode_AsUTF8(node->data.fee.m_module), fptr);
169
+ } else {
170
+ fputs("<unknown>", fptr);
171
+ }
156
172
  fputc('.', fptr);
157
173
  } else {
158
174
  // The function is a class method
@@ -526,8 +526,9 @@ tracer_pyreturn_callback(TracerObject* self, PyCodeObject* code, PyObject* arg)
526
526
 
527
527
  if (!PyCode_Check(call_code) || call_code != code) {
528
528
  self->collecting = 0;
529
- PyErr_SetString(PyExc_RuntimeError, "VizTracer: Unexpected type. Might be an event mismatch.");
530
- return -1;
529
+ PyErr_WarnEx(PyExc_RuntimeWarning,
530
+ "VizTracer: Unexpected function return, tracing is stopped", 1);
531
+ return 0;
531
532
  }
532
533
 
533
534
  struct EventNode* node = get_next_node(self);
@@ -615,8 +616,9 @@ tracer_creturn_callback(TracerObject* self, PyCodeObject* code, PyObject* arg)
615
616
 
616
617
  if (!PyCFunction_Check(cfunc)) {
617
618
  self->collecting = 0;
618
- PyErr_SetString(PyExc_RuntimeError, "VizTracer: Unexpected type. Might be an event mismatch.");
619
- return -1;
619
+ PyErr_WarnEx(PyExc_RuntimeWarning,
620
+ "VizTracer: Unexpected function return, tracing is stopped", 1);
621
+ return 0;
620
622
  }
621
623
 
622
624
  struct EventNode* node = get_next_node(self);
viztracer/patch.py CHANGED
@@ -53,6 +53,10 @@ def patch_subprocess(viz_args: list[str]) -> None:
53
53
  # -m mod | -mmod
54
54
  cm_arg = cm_arg or next(args_iter, None)
55
55
  if cm_arg is not None:
56
+ if cm_arg.split('.')[0] == "viztracer":
57
+ # Avoid tracing viztracer subprocess
58
+ # This is mainly used to avoid tracing --open
59
+ return None
56
60
  mode.append(cm_arg)
57
61
  else:
58
62
  mode = None
@@ -60,6 +64,12 @@ def patch_subprocess(viz_args: list[str]) -> None:
60
64
 
61
65
  # -pyopts
62
66
  py_args.append(arg)
67
+ if arg in ("-X", "-W", "--check-hash-based-pycs"):
68
+ arg_next = next(args_iter, None)
69
+ if arg_next is not None:
70
+ py_args.append(arg_next)
71
+ else:
72
+ return None
63
73
 
64
74
  if script:
65
75
  return [sys.executable, *py_args, "-m", "viztracer", "--quiet", *viz_args, "--", script, *args_iter]
Binary file
Binary file
viztracer/viewer.py CHANGED
@@ -88,6 +88,8 @@ class PerfettoHandler(HttpHandler):
88
88
  self.end_headers()
89
89
  self.wfile.write(json.dumps(self.server_thread.file_info).encode("utf-8"))
90
90
  self.wfile.flush()
91
+ # Since v1.1, file_info is the last request from the frontend
92
+ self.server.trace_served = True
91
93
  elif self.path.endswith("localtrace"):
92
94
  # self.directory is used after 3.8
93
95
  # os.getcwd() is used on 3.6
@@ -95,7 +97,6 @@ class PerfettoHandler(HttpHandler):
95
97
  with chdir_temp(self.directory):
96
98
  filename = os.path.basename(self.server_thread.path)
97
99
  self.path = f"/{filename}"
98
- self.server.trace_served = True
99
100
  return super().do_GET()
100
101
  else:
101
102
  self.directory = os.path.join(os.path.dirname(__file__), "web_dist")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: viztracer
3
- Version: 1.1.0
3
+ Version: 1.1.1
4
4
  Summary: A debugging and profiling tool that can trace and visualize python code execution
5
5
  Author-email: Tian Gao <gaogaotiantian@hotmail.com>
6
6
  License-Expression: Apache-2.0
@@ -301,6 +301,16 @@ normal sampling profilers.
301
301
 
302
302
  </details>
303
303
 
304
+ ## Sponsors
305
+
306
+ We thank our sponsors to support VizTracer. If you want your logo here,
307
+ check our [sponsor page](https://github.com/sponsors/gaogaotiantian) or contact
308
+ the [author](https://github.com/gaogaotiantian) directly.
309
+
310
+ <a href="https://www.lambdatest.com/?utm_source=viztracer&utm_medium=sponsor" target="_blank">
311
+ <img src="https://www.lambdatest.com/blue-logo.png" style="vertical-align: middle;" width="250" height="45" />
312
+ </a>
313
+
304
314
  ## Documentation
305
315
 
306
316
  For full documentation, please see [https://viztracer.readthedocs.io/en/stable](https://viztracer.readthedocs.io/en/stable)
@@ -1,7 +1,7 @@
1
1
  viztracer/report_builder.py,sha256=CGQ0czLrPDDh6m6MFGArRM1Ewnpbm1KQL2iuUYDLwFA,14186
2
- viztracer/patch.py,sha256=1KYYrgdDbVfiUux_lv6a-4uCQszS-AdQlhL2u5KD2X4,12460
3
- viztracer/snaptrace.cpython-312-darwin.so,sha256=MiCy-HCHHUhPZFZhGAqkSIJ_LLivE311Kjs_rUYyD-I,85328
4
- viztracer/viewer.py,sha256=A_ZUybPYmEgL0aLIqmj4sR4xAtjwhW-bLz0r6CuJfbE,19682
2
+ viztracer/patch.py,sha256=zxSKnv9Wr7p8NVUHy46mIBDNRARvGwnfqMTAsJ6VidU,12955
3
+ viztracer/snaptrace.cpython-312-darwin.so,sha256=quhf2R5HnZ1kSX6y17YXz_034bn5UWLqhTEAPtubQ58,60816
4
+ viztracer/viewer.py,sha256=o2tLt6_xN5GvddXYgeyN2VAv1-9DWVS37yHihMYfC3Q,19752
5
5
  viztracer/vizevent.py,sha256=5fKdUp1RDx5SescpffDNvDaV2SaF8H1WgNuvk2ybujY,971
6
6
  viztracer/vizplugin.py,sha256=SzoA3skl7cLtgJDtMogUzqn7Yb-C8HGZ1La_jqooEVI,5339
7
7
  viztracer/util.py,sha256=s4T0h8jA3Ny4QcHDXbMPGGRNUXXyAcYqLgPR0bk8yUo,6100
@@ -9,7 +9,7 @@ viztracer/decorator.py,sha256=XhNMxdMM1qs5W22B5sBIbOWtZahHYTLOc0TKtTZhxH4,5699
9
9
  viztracer/snaptrace.pyi,sha256=a7z19WnUa2MPFdEZOpd_fUHL7IizrP4P0uk8QFMuVhA,1793
10
10
  viztracer/attach.py,sha256=VsEE3G_mpqMkiGwWiV0kNPe7VMlG_cjiOr8opDRiUAI,1991
11
11
  viztracer/viztracer.py,sha256=RcZ59vkeOwYHcjuaum8R7eObH1dTT8WYrDGEImVi558,17851
12
- viztracer/__init__.py,sha256=Apna-Ca9rtndiVHRUy54Qc8UWigwbGbE9HMhl9dzti8,507
12
+ viztracer/__init__.py,sha256=fdwl94zpBuVrw1_ztf57BOru3Le3Gg_LLF045A564O4,507
13
13
  viztracer/vizcounter.py,sha256=aqTTg0FxYE82fn__TXF_Mk3nU9Sbn5N3P1AdlSwV7bg,793
14
14
  viztracer/functree.py,sha256=KKkGrqf5L4L4c2PC_zX6QVqwlF8SxRID4UOZaI5wOaI,5188
15
15
  viztracer/vizlogging.py,sha256=cyrkW2sAWvG5z1n-OGI_eZMgS1N9ADFkqapHu6XWamM,668
@@ -17,8 +17,8 @@ viztracer/vizobject.py,sha256=vBoPBIzCIYb6yCrLTzsSdPNAtN3fprD1Yd7a36Tlccs,1240
17
17
  viztracer/vcompressor.pyi,sha256=6F6W8rREivfR1G4WI20xd50mSoayX9DkEf2Wi43-k-A,320
18
18
  viztracer/cellmagic.py,sha256=SLibORC1-Rjk2a66IIMMuV-Q6Rotg-4FaawzGH0oWIM,3365
19
19
  viztracer/event_base.py,sha256=4embca1Ixlb_baUZD3MfFTvuKoy7y_zhHI9uq3eomL8,3130
20
- viztracer/main.py,sha256=cY8wj0IDnWBC3af7TEqHz9d2CQCt7YV1VUFWYKyBrtI,31837
21
- viztracer/vcompressor.cpython-312-darwin.so,sha256=RnPclTyQLPBKLbX0dDzyMaM2e2sZMtsjE1Af5W7OPXc,73656
20
+ viztracer/main.py,sha256=NMhSVY0SvslqEiChFs1ZmMIHNdYqCxGUn3K2suVXPgY,32007
21
+ viztracer/vcompressor.cpython-312-darwin.so,sha256=6us7cWY_nYSnGe7ReW59xrSsE2B2GwR0mZTd3CElSjM,36792
22
22
  viztracer/__main__.py,sha256=-hhsTtiwE9cbgOj7DJGOaTJC8URmcRdicHRMSp4SnPo,226
23
23
  viztracer/code_monkey.py,sha256=jJrV4OWgYaCZyMe6Jk4jP8S6ck6pG5gBDZ_dxeXscGU,15279
24
24
  viztracer/web_dist/index.html,sha256=JwShy-t2ZMoxepYiNy6P9zlqnDznzmKjTHqL4R4RHGw,5790
@@ -83,13 +83,13 @@ viztracer/attach_process/linux_and_mac/lldb_prepare.py,sha256=h8dcRDjmohAxrWPpq5
83
83
  viztracer/html/flamegraph.html,sha256=BxbaPmmacZHdFXXD3LwTu0-IlE5ui3Y6s7fQbaPTY1k,1663
84
84
  viztracer/html/trace_viewer_embedder.html,sha256=hkY7VyVe6pq5syldbwRsqEW2wm9wgdnrHembwm7mC-o,6734
85
85
  viztracer/html/trace_viewer_full.html,sha256=h1TCFm2omE61KE0n-lovJcVVmxvGAIFxjJbI6yiJGjM,2598333
86
- viztracer/modules/snaptrace.c,sha256=kNZ2uBGHYgs8owQpT7jSbyCH6puZHtr6dSlCPA51ErM,69705
86
+ viztracer/modules/snaptrace.c,sha256=J-mcQSg5q_050iByxiY1IZKB9uNx7JKhUiXkDADhKOQ,69751
87
87
  viztracer/modules/util.c,sha256=rFvn_9azPipunH4yEX0ALRluljvS2pg-E0oWfva2rps,1303
88
88
  viztracer/modules/eventnode.h,sha256=hQ9AoNjHLZqYlI3R2BoCITjFVw16XSrbFefx1lV0ews,1541
89
89
  viztracer/modules/pythoncapi_compat.h,sha256=9Fk7ww3THeLnoOmpEUnh0C86ZHD2Tfe4kDA7oDlahOc,46185
90
90
  viztracer/modules/quicktime.c,sha256=iT3AkQw2pxPOzVhY1OlWEStavSsY_j_kDwR3SyDCTSk,4102
91
91
  viztracer/modules/snaptrace.h,sha256=Vf21wB9-rhfgKzB-lDwvGlxYyT0hDuJ7lTtlg0X0NoA,4016
92
- viztracer/modules/eventnode.c,sha256=hIdE7fCW_BqwDE6zulfPC_dXpxLPSxkxH1-PXph-mYU,5711
92
+ viztracer/modules/eventnode.c,sha256=zacMDr3kR9n3qYOgT-HdY3w7eO2xLR7oMPGCx2gA7Gg,6210
93
93
  viztracer/modules/snaptrace_member.c,sha256=mkAN7xibIplRshyEXubKYT3ZFd2Leg93OEeVxtfhDp0,13757
94
94
  viztracer/modules/util.h,sha256=x5V0b71CjSD2HLjW513mMM1Hf1pxzBiD-0G2i477cFM,586
95
95
  viztracer/modules/quicktime.h,sha256=Aooi4aRl3awX9BoU99FHnvF0MMc7YxGulbMacsIbzg0,2354
@@ -97,10 +97,10 @@ viztracer/modules/vcompressor/vcompressor.h,sha256=ZV6Z1N_C8gsmXH7J6vIZm6EXcsrwd
97
97
  viztracer/modules/vcompressor/vc_dump.c,sha256=K9_MVaWp9VORCjKcEKEpmDPvrWeo6a8iWjahGDZI5RA,39337
98
98
  viztracer/modules/vcompressor/vcompressor.c,sha256=6KgwtIhcSQwQei7nmwvdxbcxKn7z_7hqlT7ORGScKhw,12664
99
99
  viztracer/modules/vcompressor/vc_dump.h,sha256=gxFuI3Pm3DPXHvO00XF5QJ8AT9PeAtHo7ojwUgvO8Lk,1421
100
- viztracer-1.1.0.dist-info/RECORD,,
101
- viztracer-1.1.0.dist-info/WHEEL,sha256=MdxgY50Fc-IVjK3WCRGjXjKIDI1Of7db2_McocDAT3I,137
102
- viztracer-1.1.0.dist-info/entry_points.txt,sha256=-MeyWMzg_Ci74E8Y3dr_pjzZlYWq3nQYTA41OQcrZ48,91
103
- viztracer-1.1.0.dist-info/top_level.txt,sha256=xph8Zo9F28dycmRhR2cr64PLrKzc_ulOQ_lzqT3Di28,10
104
- viztracer-1.1.0.dist-info/METADATA,sha256=J8n31MotIp1WyrHEB3pMNHI_RguMH1yWmIMCUgVNS5w,13112
105
- viztracer-1.1.0.dist-info/licenses/LICENSE,sha256=pvJg_eSaSgdfGDmIDrCrtrz-nU5svUG8y1u1AafTWt8,11935
106
- viztracer-1.1.0.dist-info/licenses/NOTICE.txt,sha256=0TrouYbPH7Zwnrq2k2H6PfRyQJWO4aUew3685aqraZQ,1031
100
+ viztracer-1.1.1.dist-info/RECORD,,
101
+ viztracer-1.1.1.dist-info/WHEEL,sha256=MdxgY50Fc-IVjK3WCRGjXjKIDI1Of7db2_McocDAT3I,137
102
+ viztracer-1.1.1.dist-info/entry_points.txt,sha256=-MeyWMzg_Ci74E8Y3dr_pjzZlYWq3nQYTA41OQcrZ48,91
103
+ viztracer-1.1.1.dist-info/top_level.txt,sha256=xph8Zo9F28dycmRhR2cr64PLrKzc_ulOQ_lzqT3Di28,10
104
+ viztracer-1.1.1.dist-info/METADATA,sha256=LV4HSB8SKh2OUYJlK4pAVG7eZaGlGTzxYcHLH9HY_N4,13552
105
+ viztracer-1.1.1.dist-info/licenses/LICENSE,sha256=pvJg_eSaSgdfGDmIDrCrtrz-nU5svUG8y1u1AafTWt8,11935
106
+ viztracer-1.1.1.dist-info/licenses/NOTICE.txt,sha256=0TrouYbPH7Zwnrq2k2H6PfRyQJWO4aUew3685aqraZQ,1031