maim icon indicating copy to clipboard operation
maim copied to clipboard

Screen freezes for a bit whenever i use maim

Open rml2002 opened this issue 2 years ago • 3 comments

Hi,

I've been having some problem with the command maim recently, every time I use a simple command such as: maim test.jpg The screen freezes for a bit, as if it was flickering. It is something really quick but I wanted to take screenshots as smoothly as possible.

i don't know if it has to do with the command or my pc hardware. My configurations are: OS: IGX 3.0.46 x86_64 Kernel: 5.10.0-19-amd64 Shell: bash 5.1.4 CPU: AMD G-T48N (2) @ 1.400GHz GPU: AMD ATI Radeon HD 6310 Memory: 835MiB / 3550MiB

Hope someone can help me with this one.

rml2002 avatar Dec 02 '22 12:12 rml2002

I currently don't have a proper machine to debug this on, but I can ask you recording these three values (please run benchmarks on idling machine!):

  1. time maim test.jpg (this one will just output time);
  2. strace -rf maim test.jpg (this one will output a long list of syscall timestamps, please save it in file and upload somewhere so I can download it);
  3. perf record -F 1000 maim test.jpg (this one will create perf.data file, please upload it somewhere and include a link).

Hopefully this will help us seeing where maim spends most of its time (and probably find the reason for your screen freezing problem).

foxpy avatar Dec 18 '22 15:12 foxpy

Here are the outputs:

time maim test.jpg real 0m0.417s user 0m0.143s sys 0m0.096s

strace -rf maim test.jpg strace.txt

perf record -F 1000 maim test.jpg https://drive.google.com/file/d/136LyOYn9e0SEgF9aikVjtHzl90jlOVVr/view?usp=drivesdk

rml2002 avatar Dec 21 '22 17:12 rml2002

Hey @rml2002

Sorry for making you wait so much. I have been postponing this issue for a long time because I feel under-qualified to resolve it.

So, after analysing your strace report (perf report turned out to be not as useful), I have figured out maim waits whopping 112 milliseconds for reply from X11, while practically doing nothing. I guess your system freezes for precisely this amount of time?

Nevertheless, I have no idea how to resolve this issue. Also damn, this CPU is really slow, each system call in your report takes 20-25 more time than a CPU on my test stand.

foxpy avatar Feb 25 '23 17:02 foxpy