GoogleCloudPlatform / GoogleCloudPlatform/cloud-profiler-python

Use PyFrame_GetLineNumber to get line numbers

Ouverte
#8 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
32
Forks
35
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

The CPU profiler currently [uses `f_lineno`](https://github.com/GoogleCloudPlatform/cloud-profiler-python/blob/master/googlecloudprofiler/src/profiler.cc#L163) as the line associated with each sample. However, `f_lineno` points to the start of the frame. Looking at a source listing of these profiles in pprof results in all samples appearing to be from the function definition.

One can use [`PyFrame_GetLineNumber`](https://docs.python.org/3/c-api/reflection.html) (available in Python 2.7 as well) instead to get the currently-executing line from a frame. This can help understand where within a function the program is executing.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.