Skip to content

Commit

Permalink
Remove vdb from the code base (#370)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaogaotiantian authored Oct 4, 2023
1 parent 65bfd55 commit e68ab96
Show file tree
Hide file tree
Showing 23 changed files with 5 additions and 1,238 deletions.
2 changes: 0 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ cover_pylib = True
source = viztracer
omit =
*/viztracer/attach_process/*
*/viztracer/prog_snapshot.py
*/viztracer/simulator.py
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,17 +248,6 @@ Refer to [remote attach docs](https://viztracer.readthedocs.io/en/stable/remote_

VizTracer needs to dump the internal data to json format. It is recommended for the users to install ```orjson```, which is much faster than the builtin ```json``` library. VizTracer will try to import ```orjson``` and fall back to the builtin ```json``` library if ```orjson``` does not exist.

## Virtual Debug

You can virtually debug your program with you saved json report. The interface is very similar to ```pdb```. Even better, you can **go back in time**
because VizTracer has all the info recorded for you.

```sh
vdb <your_json_report>
```

Refer to the [docs](https://viztracer.readthedocs.io/en/stable/virtual_debug.html) for detailed commands

## Performance

VizTracer will introduce 2x to 3x overhead in the worst case. The overhead is much better if there are less function calls or if filters are applied correctly.
Expand Down
14 changes: 0 additions & 14 deletions docs/source/basic_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -241,20 +241,6 @@ this usage.
viztracer --align_combine run1.json run2.json -o compare_report.json
Debug Your Saved Report
-----------------------

VizTracer allows you to debug your json report just like pdb. You can understand how your program is executed by
interact with it. Even better, you can **go back in time** because you know what happened before.

**This feature will be removed from 0.16.0**

.. code-block::
vdb <your_json_report>
For detailed commands, please refer to :doc:`virtual_debug`

Compress Your Report
--------------------

Expand Down
3 changes: 1 addition & 2 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ You can also download the source code and build it yourself.
Even though VizTracer functions without any other packages, it is still recommended to install the following packages to have a better performance.

* orjson: better json dump/load performance
* rich: better interactive shell for vdb

.. code-block::
pip install orjson rich
pip install orjson
Or you can install *full* version of viztracer:

Expand Down
87 changes: 0 additions & 87 deletions docs/source/virtual_debug.rst

This file was deleted.

13 changes: 0 additions & 13 deletions docs/source/viztracer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ VizTracer
log_print=False,\
log_gc=False,\
log_async=False,\
vdb=False,\
pid_suffix=False,\
register_global=True,\
min_duration=0,\
Expand Down Expand Up @@ -190,18 +189,6 @@ VizTracer
viztracer --log_async
.. py:attribute:: vdb
:type: boolean
:value: False

whether make viztracer instrument for vdb, which would affect the overhead and the file size a bit

Setting it to ``True`` is equivalent to

.. code-block::
viztracer --vdb
.. py:attribute:: register_global
:type: boolean
:value: True
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ HomePage = "https://github.com/gaogaotiantian/viztracer"
Documentation = "https://viztracer.readthedocs.io"

[project.optional-dependencies]
full = ["rich", "orjson"]
full = ["orjson"]

[project.scripts]
viztracer = "viztracer:main"
vizviewer = "viztracer:viewer_main"
vdb = "viztracer:sim_main"

[tool.setuptools.dynamic]
version = {attr = "viztracer.__version__"}
1 change: 0 additions & 1 deletion src/viztracer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from .cellmagic import load_ipython_extension
from .decorator import ignore_function, log_sparse, trace_and_save
from .main import main
from .simulator import main as sim_main
from .viewer import viewer_main
from .vizcounter import VizCounter
from .vizlogging import VizLoggingHandler
Expand Down
3 changes: 0 additions & 3 deletions src/viztracer/functree.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class FuncTreeNode:
def __init__(self, event: Optional[Dict[str, Any]] = None) -> None:
self.filename: Optional[str] = None
self.lineno: Optional[int] = None
self.caller_lineno: int = -1
self.is_python: Optional[bool] = False
self.funcname: Optional[str] = None
self.parent: Optional[FuncTreeNode] = None
Expand All @@ -35,8 +34,6 @@ def __init__(self, event: Optional[Dict[str, Any]] = None) -> None:
self.funcname = m.group(1)
self.filename = m.group(2)
self.lineno = int(m.group(3))
if "caller_lineno" in self.event:
self.caller_lineno = self.event["caller_lineno"]

def is_ancestor(self, other: "FuncTreeNode") -> bool:
return self.start < other.start and self.end > other.end
Expand Down
3 changes: 0 additions & 3 deletions src/viztracer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ def create_parser(self) -> argparse.ArgumentParser:
help="Process VizTracer specific comments")
parser.add_argument("--minimize_memory", action="store_true", default=False,
help="Use json.dump to dump chunks to file to save memory")
parser.add_argument("--vdb", action="store_true", default=False,
help="Instrument for vdb, will increase the overhead")
parser.add_argument("--pid_suffix", action="store_true", default=False,
help=("append pid to file name. "
"This should be used when you try to trace multi process programs. "
Expand Down Expand Up @@ -255,7 +253,6 @@ def parse(self, argv: List[str]) -> VizProcedureResult:
"log_sparse": options.log_sparse,
"log_async": options.log_async,
"log_audit": options.log_audit,
"vdb": options.vdb,
"pid_suffix": True,
"file_info": False,
"register_global": True,
Expand Down
1 change: 0 additions & 1 deletion src/viztracer/modules/eventnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ struct FEEData {
};
};
int type;
int caller_lineno;
double dur;
PyObject* asyncio_task;
};
Expand Down
32 changes: 2 additions & 30 deletions src/viztracer/modules/snaptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,11 +438,6 @@ snaptrace_tracefunc(PyObject* obj, PyFrameObject* frame, int what, PyObject* arg
if (CHECK_FLAG(self->check_flags, SNAPTRACE_LOG_RETURN_VALUE)) {
node->data.fee.retval = PyObject_Repr(arg);
}
if (!CHECK_FLAG(self->check_flags, SNAPTRACE_NOVDB) && f_back) {
node->data.fee.caller_lineno = PyFrame_GetLineNumber(f_back);
} else {
node->data.fee.caller_lineno = -1;
}
} else if (is_c) {
PyCFunctionObject* cfunc = (PyCFunctionObject*) arg;
node->data.fee.ml_name = cfunc->m_ml->ml_name;
Expand All @@ -461,11 +456,6 @@ snaptrace_tracefunc(PyObject* obj, PyFrameObject* frame, int what, PyObject* arg
node->data.fee.tp_name = NULL;
}
}
if (!CHECK_FLAG(self->check_flags, SNAPTRACE_NOVDB)) {
node->data.fee.caller_lineno = PyFrame_GetLineNumber(frame);
} else {
node->data.fee.caller_lineno = -1;
}
}

if (CHECK_FLAG(self->check_flags, SNAPTRACE_LOG_ASYNC)) {
Expand Down Expand Up @@ -759,12 +749,6 @@ snaptrace_load(TracerObject* self, PyObject* args)
PyDict_SetItemString(dict, "name", name);
Py_DECREF(name);

if (node->data.fee.caller_lineno >= 0) {
PyObject* caller_lineno = PyLong_FromLong(node->data.fee.caller_lineno);
PyDict_SetItemString(dict, "caller_lineno", caller_lineno);
Py_DECREF(caller_lineno);
}

PyObject* arg_dict = NULL;
if (node->data.fee.args) {
arg_dict = node->data.fee.args;
Expand Down Expand Up @@ -986,10 +970,6 @@ snaptrace_dump(TracerObject* self, PyObject* args)
fprintfeename(fptr, node, sanitize_function_name);
fputc('\"', fptr);

if (node->data.fee.caller_lineno >= 0) {
fprintf(fptr, ",\"caller_lineno\":%d", node->data.fee.caller_lineno);
}

PyObject* arg_dict = NULL;
if (node->data.fee.args) {
arg_dict = node->data.fee.args;
Expand Down Expand Up @@ -1157,7 +1137,7 @@ snaptrace_config(TracerObject* self, PyObject* args, PyObject* kw)
{
static char* kwlist[] = {"verbose", "lib_file_path", "max_stack_depth",
"include_files", "exclude_files", "ignore_c_function", "ignore_frozen",
"log_func_retval", "vdb", "log_func_args", "log_async", "trace_self",
"log_func_retval", "log_func_args", "log_async", "trace_self",
"min_duration",
NULL};
int kw_verbose = -1;
Expand All @@ -1168,12 +1148,11 @@ snaptrace_config(TracerObject* self, PyObject* args, PyObject* kw)
int kw_ignore_c_function = -1;
int kw_ignore_frozen = -1;
int kw_log_func_retval = -1;
int kw_vdb = -1;
int kw_log_func_args = -1;
int kw_log_async = -1;
int kw_trace_self = -1;
double kw_min_duration = 0;
if (!PyArg_ParseTupleAndKeywords(args, kw, "|isiOOpppppppd", kwlist,
if (!PyArg_ParseTupleAndKeywords(args, kw, "|isiOOppppppd", kwlist,
&kw_verbose,
&kw_lib_file_path,
&kw_max_stack_depth,
Expand All @@ -1182,7 +1161,6 @@ snaptrace_config(TracerObject* self, PyObject* args, PyObject* kw)
&kw_ignore_c_function,
&kw_ignore_frozen,
&kw_log_func_retval,
&kw_vdb,
&kw_log_func_args,
&kw_log_async,
&kw_trace_self,
Expand Down Expand Up @@ -1228,12 +1206,6 @@ snaptrace_config(TracerObject* self, PyObject* args, PyObject* kw)
UNSET_FLAG(self->check_flags, SNAPTRACE_LOG_RETURN_VALUE);
}

if (kw_vdb == 0) {
SET_FLAG(self->check_flags, SNAPTRACE_NOVDB);
} else if (kw_vdb == 1) {
UNSET_FLAG(self->check_flags, SNAPTRACE_NOVDB);
}

if (kw_log_func_args == 1) {
SET_FLAG(self->check_flags, SNAPTRACE_LOG_FUNCTION_ARGS);
} else if (kw_log_func_args == 0) {
Expand Down
1 change: 0 additions & 1 deletion src/viztracer/modules/snaptrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#define SNAPTRACE_EXCLUDE_FILES (1 << 2)
#define SNAPTRACE_IGNORE_C_FUNCTION (1 << 3)
#define SNAPTRACE_LOG_RETURN_VALUE (1 << 4)
#define SNAPTRACE_NOVDB (1 << 5)
#define SNAPTRACE_LOG_FUNCTION_ARGS (1 << 6)
#define SNAPTRACE_IGNORE_FROZEN (1 << 7)
#define SNAPTRACE_LOG_ASYNC (1 << 8)
Expand Down
Loading

0 comments on commit e68ab96

Please sign in to comment.