Skip to content

Commit

Permalink
#3796 show paint stats on window info
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Mar 29, 2023
1 parent ef12b1d commit d45f351
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion xpra/client/gtk_base/window_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def pv(value):
if isinstance(value, (tuple, list)):
return csv(value)
if isinstance(value, dict):
return dict_to_str(dict((k,v) for k,v in value.items() if k in ("type", "encoding", )), ", ", ":")
return dict_to_str(value, ", ", ":")
return str(value)
def dict_to_str(d, sep="\n", eq="=", exclude=()):
strdict = dict((k,pv(v)) for k,v in d.items() if k not in exclude)
Expand All @@ -268,6 +268,7 @@ def dict_to_str(d, sep="\n", eq="=", exclude=()):
"fps",
"mmap",
"type",
"bit-depth",
)
))
else:
Expand Down
6 changes: 6 additions & 0 deletions xpra/client/gui/window_backing_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,14 @@ def __init__(self, wid : int, window_alpha : bool):
self.fps_buffer_update_time = 0
self.fps_value = 0
self.fps_refresh_timer = 0
self.paint_stats = {}

def idle_add(self, *_args, **_kwargs):
raise NotImplementedError()

def recpaint(self, encoding):
self.paint_stats[encoding] = self.paint_stats.get(encoding, 0) + 1

def get_rgb_formats(self):
if self._alpha_enabled:
return self.RGB_MODES
Expand All @@ -188,6 +192,7 @@ def get_info(self):
"render-size" : self.render_size,
"offsets" : self.offsets,
"fps" : self.fps_value,
"paint" : self.paint_stats,
}
vd = self._video_decoder
if vd:
Expand Down Expand Up @@ -879,6 +884,7 @@ def paint_scroll(self, img_data, options, callbacks):

def draw_region(self, x, y, width, height, coding, img_data, rowstride, options, callbacks):
""" dispatches the paint to one of the paint_XXXX methods """
self.recpaint(coding)
try:
assert self._backing is not None
log("draw_region(%s, %s, %s, %s, %s, %s bytes, %s, %s, %s)",
Expand Down

0 comments on commit d45f351

Please sign in to comment.