mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
tools/gst-plot-timeline.py: Better log parsing (categories can have -). Adjust text vs. lines, so that they span the ...
Original commit message from CVS: * tools/gst-plot-timeline.py: Better log parsing (categories can have -). Adjust text vs. lines, so that they span the same y-range.
This commit is contained in:
parent
1a140c99a6
commit
833590f239
2 changed files with 30 additions and 5 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2007-07-20 Stefan Kost <ensonic@users.sf.net>
|
||||||
|
|
||||||
|
* tools/gst-plot-timeline.py:
|
||||||
|
Better log parsing (categories can have -). Adjust text vs. lines, so
|
||||||
|
that they span the same y-range.
|
||||||
|
|
||||||
2007-07-20 Stefan Kost <ensonic@users.sf.net>
|
2007-07-20 Stefan Kost <ensonic@users.sf.net>
|
||||||
|
|
||||||
* docs/random/ensonic/audiobaseclasses.txt:
|
* docs/random/ensonic/audiobaseclasses.txt:
|
||||||
|
|
|
@ -15,8 +15,10 @@ import cairo
|
||||||
|
|
||||||
FONT_NAME = "Bitstream Vera Sans"
|
FONT_NAME = "Bitstream Vera Sans"
|
||||||
FONT_SIZE = 8
|
FONT_SIZE = 8
|
||||||
PIXELS_PER_SECOND = 1700
|
# how many pixels for a second on the timeline
|
||||||
PIXELS_PER_LINE = 12
|
PIXELS_PER_SECOND = 300
|
||||||
|
# how many pixels for one line of log
|
||||||
|
PIXELS_PER_LINE = 10
|
||||||
PLOT_WIDTH = 1400
|
PLOT_WIDTH = 1400
|
||||||
TIME_SCALE_WIDTH = 20
|
TIME_SCALE_WIDTH = 20
|
||||||
SYSCALL_MARKER_WIDTH = 20
|
SYSCALL_MARKER_WIDTH = 20
|
||||||
|
@ -25,7 +27,8 @@ LOG_MARKER_WIDTH = 20
|
||||||
BACKGROUND_COLOR = (0, 0, 0)
|
BACKGROUND_COLOR = (0, 0, 0)
|
||||||
|
|
||||||
# assumes GST_DEBUG_LOG_COLOR=1
|
# assumes GST_DEBUG_LOG_COLOR=1
|
||||||
mark_regex = re.compile (r'^(\d:\d\d:\d\d\.\d+) +\d+ 0?x?[0-9a-f]+ [A-Z]+ +([a-zA-Z_]+ )(.*)')
|
# timestamp pid thread level category,file,line,msg
|
||||||
|
mark_regex = re.compile (r'^(\d:\d\d:\d\d\.\d+) +\d+ 0?x?[0-9a-f]+ [A-Z]+ +([-a-zA-Z0-9_]+ )(.*)')
|
||||||
mark_timestamp_group = 1
|
mark_timestamp_group = 1
|
||||||
mark_program_group = 2
|
mark_program_group = 2
|
||||||
mark_log_group = 3
|
mark_log_group = 3
|
||||||
|
@ -115,6 +118,9 @@ def normalize_timestamps(syscalls):
|
||||||
syscall.timestamp -= first_timestamp
|
syscall.timestamp -= first_timestamp
|
||||||
|
|
||||||
def compute_syscall_metrics(syscalls):
|
def compute_syscall_metrics(syscalls):
|
||||||
|
global PIXELS_PER_SECOND
|
||||||
|
global PIXELS_PER_LINE
|
||||||
|
|
||||||
num_syscalls = len(syscalls)
|
num_syscalls = len(syscalls)
|
||||||
|
|
||||||
metrics = Metrics()
|
metrics = Metrics()
|
||||||
|
@ -122,8 +128,19 @@ def compute_syscall_metrics(syscalls):
|
||||||
|
|
||||||
last_timestamp = syscalls[num_syscalls - 1].timestamp
|
last_timestamp = syscalls[num_syscalls - 1].timestamp
|
||||||
num_seconds = int(math.ceil(last_timestamp))
|
num_seconds = int(math.ceil(last_timestamp))
|
||||||
metrics.height = max(num_seconds * PIXELS_PER_SECOND,
|
|
||||||
num_syscalls * PIXELS_PER_LINE)
|
time_height = num_seconds * PIXELS_PER_SECOND
|
||||||
|
line_height = num_syscalls * PIXELS_PER_LINE
|
||||||
|
if time_height > line_height:
|
||||||
|
metrics.height = time_height
|
||||||
|
print "Adjusting PIXELS_PER_LINE = %d" % PIXELS_PER_LINE
|
||||||
|
PIXELS_PER_LINE = metrics.height / num_syscalls
|
||||||
|
print " PIXELS_PER_LINE = %d" % PIXELS_PER_LINE
|
||||||
|
else:
|
||||||
|
metrics.height = line_height
|
||||||
|
print "Adjusting PIXELS_PER_SECOND %d" % PIXELS_PER_SECOND
|
||||||
|
PIXELS_PER_SECOND = metrics.height / num_seconds
|
||||||
|
print " PIXELS_PER_SECOND %d" % PIXELS_PER_SECOND
|
||||||
|
|
||||||
text_ypos = 0
|
text_ypos = 0
|
||||||
|
|
||||||
|
@ -170,6 +187,8 @@ def plot_syscall(surface, ctx, syscall):
|
||||||
def plot_syscalls_to_surface(syscalls, metrics):
|
def plot_syscalls_to_surface(syscalls, metrics):
|
||||||
num_syscalls = len(syscalls)
|
num_syscalls = len(syscalls)
|
||||||
|
|
||||||
|
print 'picture size: %d x %d' % (metrics.width, metrics.height);
|
||||||
|
|
||||||
surface = cairo.ImageSurface(cairo.FORMAT_RGB24,
|
surface = cairo.ImageSurface(cairo.FORMAT_RGB24,
|
||||||
metrics.width, metrics.height)
|
metrics.width, metrics.height)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue