Skip to content

Commit

Permalink
#3930 switch to monotonic_ns
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Aug 8, 2023
1 parent 19dd549 commit 65a271a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions xpra/x11/shadow_x11_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# later version. See the file COPYING for details.

import re
from time import monotonic
from time import monotonic_ns
from typing import Any

from xpra.x11.x11_server_core import X11ServerCore
Expand Down Expand Up @@ -233,7 +233,7 @@ def get_image(self, x:int, y:int, width:int, height:int):
if self.xshm is None:
log("no xshm, cannot get image")
return None
start = monotonic()
start = monotonic_ns()
try:
with xsync:
log("X11 shadow get_image, xshm=%s", self.xshm)
Expand All @@ -243,9 +243,9 @@ def get_image(self, x:int, y:int, width:int, height:int):
self._err(e)
return None
finally:
end = monotonic()
end = monotonic_ns()
log("X11 shadow captured %s pixels at %i MPixels/s using %s",
width*height, (width*height/(end-start))//1024//1024, ["GTK", "XSHM"][XSHM])
width*height, (width*height/(end-start)), ["GTK", "XSHM"][XSHM])


def setup_capture(window):
Expand Down
6 changes: 3 additions & 3 deletions xpra/x11/x11_server_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import os
import threading
from time import monotonic
from time import monotonic_ns
from typing import Any

from xpra.x11.bindings.core import set_context_check, X11CoreBindings #@UnresolvedImport
Expand Down Expand Up @@ -361,7 +361,7 @@ def send_initial_cursors(self, ss, sharing:bool=False) -> None:


def do_get_info(self, proto, server_sources) -> dict[str,Any]:
start = monotonic()
start = monotonic_ns()
info = super().do_get_info(proto, server_sources)
sinfo = info.setdefault("server", {})
sinfo["type"] = "Python/gtk/x11"
Expand All @@ -372,7 +372,7 @@ def do_get_info(self, proto, server_sources) -> dict[str,Any]:
log(f"no drm query: {e}")
else:
sinfo["drm"] = query()
log("X11ServerCore.do_get_info took %ims", (monotonic()-start)*1000)
log("X11ServerCore.do_get_info took %ims", (monotonic_ns()-start)//1_000_000)
return info

def get_ui_info(self, proto, wids=None, *args) -> dict[str,Any]:
Expand Down

0 comments on commit 65a271a

Please sign in to comment.