LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-01-2016, 02:08 AM   #1
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Location: Apples
Distribution: Apple-selling shops, markets and direct marketing
Posts: 1,249
Blog Entries: 35

Rep: Reputation: 684Reputation: 684Reputation: 684Reputation: 684Reputation: 684Reputation: 684
Does xmodmap have to stress my CPU?


Good morning.

For convenience, I have added the french ligature characters Œ and œ to my German „~/.xmodmap.de”. Activating these key-mappings with a call to xmodmap stresses my CPU to the point that some activities are almost, others downright impossible for a few minutes.

Also, adding the call to xmodmap to my Fluxbox startup-file does nothing. I have to assume that xmodmap is not at all executed until I do it manually. Afterwards all is fine and the desired key-mappings are available.

This behavior is observed since I know about xmodmap, a time which spans several Debian-releases and at least one similar experience on Mint.

Does someone have an explanation?

TIA

Last edited by Michael Uplawski; 06-01-2016 at 03:45 AM.
 
Old 06-01-2016, 04:37 PM   #2
josephj
Member
 
Registered: Nov 2007
Location: Northeastern USA
Distribution: kubuntu
Posts: 207

Rep: Reputation: 106Reputation: 106
Try strace

That sounds really weird. I would think (not knowing the internals at all) that xmodmap just has to update a few tables, etc.. Why would it need more than a few milliseconds to do anything?

I have no idea what the real issue is.

I have never used it, but I have seen people use strace for problems like this. It tells you what a program is actually doing. The issues are getting it to invoke for the proper program instance and then knowing enough to interpret the results (which is why I don't use it )

You might also want to try your setup on a different distro with the same version of xmodmap (with a VM or live CD) to see if some other factors are at work.

As for your startup issues:

I fool around with autostart stuff in KDE. Since the autostart activity occurs when normal i/o is not connected to a terminal/display, you can't see what is happening when something doesn't work. To get around this, I modify the autostart script so that commands and added echo statements redirect their output to a file. Then I have a log file so I can see what happened and debug it after the desktop finishes loading.

Example code:

Code:
log="~/temp/autostart.log"
echo "$(date) Starting autostart" > "${log}" ## clear old log
some-command &> >> "${log}"  ## append any output from command to my log
rc=$?
echo "$(date) some command returned with [${rc}]" >> "${log}" ## and append its return status
If it takes more than a try or two to fix things, I add a debug variable so I can switch the log on and off by testing it before any line that logs something. The sleep is there because the things I am looking for don't always happen right away, so I wait a little bit before looking for them.

Code:
debug=0 ## turn off debuging output
debug=1 ## turn on debuging output
sleep 5 ## give kde some time to get started

((debug)) && echo "$(date) autostarting applications" > "${log}" ## debug

Last edited by josephj; 06-01-2016 at 05:18 PM. Reason: typo
 
1 members found this post helpful.
Old 06-01-2016, 04:52 PM   #3
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 7,231

Rep: Reputation: Disabled
~/.Xmodmap should be parsed automatically by X startup scripts.
 
Old 06-02-2016, 01:53 AM   #4
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Location: Apples
Distribution: Apple-selling shops, markets and direct marketing
Posts: 1,249

Original Poster
Blog Entries: 35

Rep: Reputation: 684Reputation: 684Reputation: 684Reputation: 684Reputation: 684Reputation: 684
@Emerson: Thank you. I have read about ~/.Xmodmap (or ~/.xmodmap). I will link my German mapping file to ~/.Xmodmap to try it out.
@josephj: Good hints, all. This morning I would like to follow all your advice at once, and just post my results here. But I have not yet the time for testing. I'll get back to that in another post.
 
Old 06-02-2016, 08:34 AM   #5
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Location: Apples
Distribution: Apple-selling shops, markets and direct marketing
Posts: 1,249

Original Poster
Blog Entries: 35

Rep: Reputation: 684Reputation: 684Reputation: 684Reputation: 684Reputation: 684Reputation: 684
(Later)
My findings so far.

The existence of a file ~/.xmodmap or ~/.Xmodmap does not have an influence. Anyway, having entered other commands in the fluxbox startup file, xmodmap is still the only one which is ignored, even if I note a specific mapping-file for the argument.

Calling strace with xmodmap ~/.xmodmap.de I get a log on standard output. The execution takes just a moment. Like without strace, the program appears to return immediately, although the CPU continues to struggle for a few minutes. This said, the log file is not long enough to cover any of this obscure activity as it is created and terminated before. However, there is only one repeated line in the strace output, which looks curious.
Code:
recvmsg(3, 0x7ffec4036ac0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(3, 0x7ffec4036ac0, 0)           = -1 EAGAIN (Resource temporarily unavailable)
For recvmsg, the resource must be a socket and it would be interesting to know which socket is currently blocked by another process. The output is the same, if I call strace as root. I venture that, without knowing the socket or process, calling lsof will not help me find the culprit, if there is any.

But as I said, strace returns quickly and the CPU continues anyway to be occupied. Many functions are unavailable for some minutes.

Last edited by Michael Uplawski; 06-02-2016 at 08:45 AM. Reason: too many words. ( I )
 
Old 06-02-2016, 08:38 AM   #6
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 7,231

Rep: Reputation: Disabled
Can you see what process it is using top?
 
1 members found this post helpful.
Old 06-02-2016, 01:48 PM   #7
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Location: Apples
Distribution: Apple-selling shops, markets and direct marketing
Posts: 1,249

Original Poster
Blog Entries: 35

Rep: Reputation: 684Reputation: 684Reputation: 684Reputation: 684Reputation: 684Reputation: 684
Quote:
Originally Posted by Emerson View Post
Can you see what process it is using top?
Thanks for reminding me. It is Xorg that uses 99% CPU for a while. Nothing fancy, I am afraid...
 
Old 06-02-2016, 02:25 PM   #8
mdooligan
Member
 
Registered: Feb 2009
Location: Vancouver BC
Distribution: Mandrake10/ArchHackery/Gentoo
Posts: 179

Rep: Reputation: 22
If it's Xorg itself chewing up the CPU cyles, perhaps there is some circular reference in it's modmaps as soon as you add those entries. Can you post the offending file contents, and the output of `xmodmap -pk`?

Also, what do you get (before you merge ~/.xmodmap.de) with xmodmap -n ~/.xmodmap.de. It should tell you what it would do, without actually doing it.

I have, in the past, completely borked my X session with a bad xmodmap merge. Also, Xorg gets confused when you play around with xmodmap too much. I found that restarting X constantly while you play with your new settings is useful. It may behave differently when it's fresh versus after many xmodmap alterations.

Last edited by mdooligan; 06-02-2016 at 02:29 PM.
 
1 members found this post helpful.
Old 06-02-2016, 03:05 PM   #9
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Location: Apples
Distribution: Apple-selling shops, markets and direct marketing
Posts: 1,249

Original Poster
Blog Entries: 35

Rep: Reputation: 684Reputation: 684Reputation: 684Reputation: 684Reputation: 684Reputation: 684
@mdooligan: Xorg is in deed misbehaving after an apparently successful execution of xmodmap. Ctrl-Alt-Backspace does no longer work and Alt-tab does not switch between windows. Anyway, here are all those weird keymaps and program-outputs that you asked for. I have to attach this as files, as the posting becomes too long, otherwise.

1. The file ~/.xmodmap.de (xmodmap.de.txt). Keycode 32 is modified for Œ and œ.
2. The output of xmodmap -pk after execution of xmodmap ~/.xmodmap.de (pk_out.txt).
3. The output of xmodmap -n in a clean Xorg session with original, unchanged key mappings (n_out.txt).
Attached Files
File Type: txt pk_out.txt (28.1 KB, 7 views)
File Type: txt n_out.txt (13.3 KB, 4 views)
File Type: txt xmodmap.de.txt (11.0 KB, 9 views)

Last edited by Michael Uplawski; 06-02-2016 at 03:06 PM. Reason: punctuation.
 
Old 06-02-2016, 05:07 PM   #10
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 7,231

Rep: Reputation: Disabled
I do not want to download these files, but I can tell by their size you can do better. Do not load the whole thing again. I have ~/.Xmodmap in home computer and it has less than 10 lines in it. Just adding some symbols I need to default keymap.
 
1 members found this post helpful.
Old 06-02-2016, 08:18 PM   #11
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 7,231

Rep: Reputation: Disabled
OK, at home now. I let system load default keymap and add only some symbols I need, see below:
Code:
 ~ $ cat .Xmodmap 
keycode 133 = Mode_switch
keycode  13 = 4 dollar 4 cent
keycode  24 = q Q otilde Otilde
keycode  26 = e E EuroSign cent
keycode  30 = u U udiaeresis Udiaeresis
keycode  32 = o O odiaeresis Odiaeresis
keycode  38 = a A adiaeresis Adiaeresis
keycode  40 = d D degree
keycode  58 = m M Greek_mu
 
1 members found this post helpful.
Old 06-03-2016, 02:40 PM   #12
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Location: Apples
Distribution: Apple-selling shops, markets and direct marketing
Posts: 1,249

Original Poster
Blog Entries: 35

Rep: Reputation: 684Reputation: 684Reputation: 684Reputation: 684Reputation: 684Reputation: 684
Cool

Excellent.

With only two lines remaining, the mapping file does exactly what I need, xmodmap returns immediately and nothing is left of the CPU trouble. This did not bug me enough to ask earlier, but I should have done so!

Thank you all and especially Emerson.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Stress CPU and RAM vedaa Linux - General 1 06-26-2015 08:37 AM
Stress test for four-core CPU Mr. Alex Linux - Software 1 12-14-2010 12:19 PM
CPU stress testing mokku Linux - Newbie 1 11-11-2007 11:22 AM
CPU stress test CTRLBREAK Linux - Hardware 2 02-24-2005 08:21 PM
Stress Testing my CPU drisay Slackware 4 10-01-2004 05:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration