Tachyon’s `--diff-flamegraph` scales times in baseline run to duration of current run
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 77.2k
- Forks
- 35.9k
- Métriques de merge des PR
- Métriques de PR en attente
Description
Bug report
Bug description:
As discussed with @pablogsal during EuroPython sprints:
Using this simple example script (flamegraph_demo.py):
import time
def main():
f_1()
f_2()
def f_1():
time.sleep(0.5) # change this to 1.5 in the second run
def f_2():
time.sleep(1)
main()
python -m profiling.sampling run --binary -o baseline.bin flamegraph_demo.py
vim flamegraph_demo.py # edit f_1 to sleep for 1.5 s
python -m profiling.sampling run --diff-flamegraph baseline.bin -o diff.html flamegraph_demo.py
generates this diff flamegraph:
f_2 is unchanged between both runs, so the “Baseline Self” time should be equal to the “Current Self” and equal to 1 s (that it displays “1 ms” is covered in #154059); however, the baseline for all functions gets scaled with the ratio of total time in this run over total time of the previous run (in this case: 2.5 s / 1.5 s = 1.667).
I can imagine scenarios where this scaling is useful (e.g. when the baseline is generated on a different machine). However, in the common case of running baseline and diff on the same machine, this scaling means that a lot of unchanged functions get colour-coded, which distracts from the few functions that experienced a meaningful change.
CPython versions tested on:
3.15
Operating systems tested on:
macOS
Linked PRs
- gh-154082
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par le point d’entrée profiling.sampling et reproduisez les commandes à l’aide de flamegraph_demo.py, en comparant baseline.bin avec diff.html. Suivez la façon dont --diff-flamegraph met à l’échelle les temps de baseline et vérifiez que f_2, qui n’a pas changé, présente des temps self de baseline et actuels égaux à 1 s, sans changements de couleur inutiles.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- performance
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100