GoogleCloudPlatform / GoogleCloudPlatform/cloud-profiler-python
Use PyFrame_GetLineNumber to get line numbers
- Linguagem predominante
- Python
- Estrelas
- 32
- Forks
- 35
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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.
Guia de contribuição
Direção de pesquisa
Comece em googlecloudprofiler/src/profiler.cc, na linha 163, onde o profiler associa f_lineno a cada amostra. Use PyFrame_GetLineNumber para a consulta e, em seguida, verifique nas listagens do código-fonte do pprof se as amostras apontam para a linha atualmente em execução, e não para a definição da função.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- cpp, python
- Domínio
- observability, performance
- Tipo de issue
- Bug
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Status de atividade
- Estagnada
- Clareza
- Claramente especificada
- Facilidade para iniciantes
- 45/100