Show More
@@ -713,6 +713,23 b' def write_to_flame(data, fp, scriptpath=' | |||||
713 | os.system("perl ~/flamegraph.pl %s > %s" % (path, outputfile)) |
|
713 | os.system("perl ~/flamegraph.pl %s > %s" % (path, outputfile)) | |
714 | print("Written to %s" % outputfile, file=fp) |
|
714 | print("Written to %s" % outputfile, file=fp) | |
715 |
|
715 | |||
|
716 | _pathcache = {} | |||
|
717 | def simplifypath(path): | |||
|
718 | '''Attempt to make the path to a Python module easier to read by | |||
|
719 | removing whatever part of the Python search path it was found | |||
|
720 | on.''' | |||
|
721 | ||||
|
722 | if path in _pathcache: | |||
|
723 | return _pathcache[path] | |||
|
724 | hgpath = encoding.__file__.rsplit(os.sep, 2)[0] | |||
|
725 | for p in [hgpath] + sys.path: | |||
|
726 | prefix = p + os.sep | |||
|
727 | if path.startswith(prefix): | |||
|
728 | path = path[len(prefix):] | |||
|
729 | break | |||
|
730 | _pathcache[path] = path | |||
|
731 | return path | |||
|
732 | ||||
716 | def write_to_json(data, fp): |
|
733 | def write_to_json(data, fp): | |
717 | samples = [] |
|
734 | samples = [] | |
718 |
|
735 |
General Comments 0
You need to be logged in to leave comments.
Login now