1 parent 8fb8187 commit db1cc42Copy full SHA for db1cc42
1 file changed
src/vmp_stack.c
@@ -82,12 +82,6 @@ int vmp_profiles_python_lines(void) {
82
83
static PY_STACK_FRAME_T * _write_python_stack_entry(PY_STACK_FRAME_T * frame, void ** result, int * depth, int max_depth)
84
{
85
- int len;
86
- int addr;
87
- int j;
88
- uint64_t line;
89
- char *lnotab;
90
-
91
#ifndef RPYTHON_VMPROF // pypy does not support line profiling
92
if (vmp_profiles_python_lines()) {
93
// In the line profiling mode we save a line number for every frame.
@@ -99,27 +93,8 @@ static PY_STACK_FRAME_T * _write_python_stack_entry(PY_STACK_FRAME_T * frame, vo
99
100
94
// NOTE: the profiling overhead can be reduced by storing co_lnotab in the dump and
101
95
// moving this computation to the reader instead of doing it here.
102
- lnotab = PyStr_AS_STRING(frame->f_code->co_lnotab);
103
104
- if (lnotab != NULL) {
105
- line = (uint64_t)frame->f_lineno;
106
- addr = 0;
107
108
- len = (int)PyStr_GET_SIZE(frame->f_code->co_lnotab);
109
110
- for (j = 0; j < len; j += 2) {
111
- addr += lnotab[j];
112
- if (addr > frame->f_lasti) {
113
- break;
114
- }
115
- line += lnotab[j+1];
116
117
- result[*depth] = (void*) line;
118
- *depth = *depth + 1;
119
- } else {
120
- result[*depth] = (void*) 0;
121
122
96
+ result[*depth] = (void*) PyFrame_GetLineNumber(frame);
97
+ *depth = *depth + 1;
123
98
}
124
result[*depth] = (void*)CODE_ADDR_TO_UID(FRAME_CODE(frame));
125
*depth = *depth + 1;
0 commit comments