Apr 30
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

I wanted to see if I could take advantage of my Dual Core CPU during boot time, by enabling concurrent init.d scripts, in the hope this could improve (an already pretty fast) boot time. The implementation is pretty simple - first, I backed up /etc/init.d/rc

cd /etc/init.d/
sudo cp rc rc.BAK

then set about editing /etc/init.d/rc

gksu gedit /etc/init.d/rc

Actually, there isn’t much to edit - I just needed to change:

CONCURRENCY=none

to:

CONCURRENCY=shell

on line 24, save the file, and reboot. However, when I rebooted, there was a gnarly error caused by HAL (Hardware Abstraction Layer) failing to initialise. After some digging, I found a bug report, and a solution. The cause of the problem, and the solution is actually quite simple. At run level 2, HAL and DBus are set to start at the same time - in the /etc/rc2.d/ directory, both symbolic links have the same S12 prefix (S12hal and S12dbus):

ls -l
...snip...
lrwxrwxrwx 1 root root 14 2008-04-26 00:52 S12dbus -> ../init.d/dbus
lrwxrwxrwx 1 root root 13 2008-04-25 18:58 S12hal -> ../init.d/hal
...snip...

which causes a problem with concurrent init.d scripts, since they are now executed at the same time. HAL initialises slightly faster than DBus, but requires DBus in order to initialise, hence the “failed to initialize” error. The solution is equally simple. As suggested in the bug report, I changed the execution order of HAL. I had to do this via the recovery console, but so long as you don’t reboot after saving the /etc/init.d/rc file, it can be done via the GUI terminal:

sudo mv /etc/rc2.d/S12hal /etc/rc2.d/S13hal
sudo reboot

This time, there was no problem, and no error, since it ensures that DBus (S12dbus) initialises before HAL (S13hal).

If I still get problems in the future, I can always restore the old version of /etc/init.d/rc:

cd /etc/init.d
sudo cp rc.BAK rc

Coupled with boot profiling, this does speed up my boot time by shaving an extra few seconds away.

written by Hodge \\ tags: , , ,

Mar 27
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...

OK, this is a bit of a cheeky post, since I’m merely extending a previous post “Conky on Ubuntu 64 Bit - .conkyrc” - or elaborating on it - to clarify setting up .conkyrc for Dual Core Processors - specifically for my AMD Turion 64 X2. I’ve had a few requests specifically about this, so here goes…

Now, the part of my .conkyrc file that deals with my Dual Core looks like this:

${color #42AE4A}Usage (Avg):${color #42AE4A} ${freq_dyn_g}Ghz ${color lightgrey}${cpu cpu0}% ${alignr}${color #42AE4A}${cpubar cpu0 5,80}
${color #42AE4A}Usage (Core 1):${color #42AE4A} ${freq_dyn_g cpu1}Ghz ${color lightgrey}${cpu cpu1}% ${alignr}${color #42AE4A}${cpubar cpu1 5,80}
${color #42AE4A}Usage (Core 2):${color #42AE4A} ${freq_dyn_g cpu2}Ghz ${color lightgrey}${cpu cpu2}% ${alignr}${color #42AE4A}${cpubar cpu2 5,80}
${color #42AE4A}Average
${cpugraph cpu0 42AE4A eeeeee}
${color #42AE4A}Core 1 $alignr Core 2
${color #42AE4A}${cpugraph cpu1 25,120 42AE4A eeeeee} ${color #42AE4A} $alignr${color #42AE4A}${cpugraph cpu2 25,120 42AE4A eeeeee}
${color #42AE4A}Processes:${color lightgrey} $processes ${color #42AE4A}Run:${color lightgrey} $running_processes ${color #42AE4A}CPU Temp:${color lightgrey} ${execi 1100 cat /proc/acpi/thermal_zone/THRM/temperature | grep -o “[0-9]* C”}
${color #42AE4A}Core 1 Temp: ${color lightgrey}${execi 8 sensors | grep -A 1 ‘Core0′ | cut -c13-16 | sed ‘/^$/d’} C ${color #42AE4A}Core 2 Temp: ${color lightgrey}${execi 8 sensors | grep -A 1 ‘Core1′ | cut -c13-16 | sed ‘/^$/d’} C

This outputs the following to Conky:

Conky Dual Core CPU Output

Stripping out all the formatting, and colouring gives this:

Usage (Avg): ${freq_dyn_g}Ghz ${cpu cpu0}% ${alignr}${cpubar cpu0 5,80}
Usage (Core 1): ${freq_dyn_g cpu1}Ghz ${cpu cpu1}% ${alignr}${cpubar cpu1 5,80}
Usage (Core 2): ${freq_dyn_g cpu2}Ghz ${cpu cpu2}% ${alignr}${cpubar cpu2 5,80}
Average
${cpugraph cpu0 42AE4A eeeeee}
Core 1 $alignr Core 2
${cpugraph cpu1 25,120 42AE4A eeeeee} $alignr${cpugraph cpu2 25,120 42AE4A eeeeee}
Processes: $processes Run: $running_processes CPU Temp: ${execi 1100 cat /proc/acpi/thermal_zone/THRM/temperature | grep -o “[0-9]* C”}
Core 1 Temp: ${execi 8 sensors | grep -A 1 ‘Core0′ | cut -c13-16 | sed ‘/^$/d’} C Core 2 Temp: ${execi 8 sensors | grep -A 1 ‘Core1′ | cut -c13-16 | sed ‘/^$/d’} C

Now the walk through. The first line, Usage (Avg): ${freq_dyn_g}Ghz ${cpu cpu0}% ${alignr}${cpubar cpu0 5,80} gives the Average clock speed usage for both cores - ${freq_dyn_g} with no parameters, will output the current clock speed usage for the CPU as a whole. Passing cpu0 as a parameter to ${cpu} will output the overall CPU % used, and similarly, passing cpu0 to ${cpubar} will draw the overall % used graph (the parameters 5,80 are just for the height and width.

Now, by passing cpu1 or cpu2 to ${freq_dny_g}, ${cpu} and ${cpubar} Conky will output the same data but for each individual core. This can be extended by passing cpuN where N is the core number, for quad core etc. this could be cpu3 cpu4. So, the first three lines:

Usage (Avg): ${freq_dyn_g}Ghz ${cpu cpu0}% ${alignr}${cpubar cpu0 5,80}
Usage (Core 1): ${freq_dyn_g cpu1}Ghz ${cpu cpu1}% ${alignr}${cpubar cpu1 5,80}
Usage (Core 2): ${freq_dyn_g cpu2}Ghz ${cpu cpu2}% ${alignr}${cpubar cpu2 5,80}

Outputs:

Conky Dual Core CPU Usage

The next lines of the file deal with throughput/usage graphs, ${cpugraph cpu0 42AE4A eeeeee} being the average for the CPU as a whole, since cpu0 is passed as a parameter. 42AE4A and eeeeee are just colour parameters to create a gradient overlay on the graph. As before, passing cpu1 and cpu2 will draw the graphs for the individual cores. The additional parameters, 25,120 are again just height and width parameters.

So, the lines

Average
${cpugraph cpu0 42AE4A eeeeee}
Core 1 $alignr Core 2
${cpugraph cpu1 25,120 42AE4A eeeeee} $alignr${cpugraph cpu2 25,120 42AE4A eeeeee}

Will output:

Conky Dual Core CPU Throughput Graphs

Finally, I have a bunch of other data output, such as total processes, processes running, and CPU temperature. The first line outputs general information about the CPU as a whole:

Processes: $processes Run: $running_processes CPU Temp: ${execi 1100 cat /proc/acpi/thermal_zone/THRM/temperature | grep -o "[0-9]* C”}

$processes outputs the total number of processes, while $running_processes outputs the number of currently running processes on the CPU. To output the overall temperature, I had to call the execi function, and do some tweaking of the output to get the number, so ${execi 1100 cat /proc/acpi/thermal_zone/THRM/temperature | grep -o “[0-9]* C”} basically outputs /proc/acpi/thermal_zone/THRM/temperature, pipes the output through grep which searches for the regular expression ‘[0-9]* C’ (which matches a string of numbers followed by a space followed by an upper-case C), and thus outputs just the temperature value - e.g. “45 C”.

To output the temperature of each Core, I once again run the execi function on a couple of piped shell commands, and pipe the output through other shell commands to get the number I want:

Core 1 Temp: ${execi 8 sensors | grep -A 1 'Core0' | cut -c13-16 | sed '/^$/d'} C Core 2 Temp: ${execi 8 sensors | grep -A 1 'Core1' | cut -c13-16 | sed '/^$/d'} C

Basically what is happening here is I’m running the shell command sensors, piping to grep to search for the string “Core0“, piing this output to cut to trim it, and finally editing out some of the crap I don’t want by piping to sed. This is just repeated for Core1. You may need to customise the output from sensors, by greping, cutting and seding different stuff - experiment by opening a terminal, and running sensors, then just pipe it through the grep, cut, and sed commands until you get the data you want.

So, the final lines together:

Processes: $processes Run: $running_processes CPU Temp: ${execi 1100 cat /proc/acpi/thermal_zone/THRM/temperature | grep -o "[0-9]* C”}
Core 1 Temp: ${execi 8 sensors | grep -A 1 ‘Core0′ | cut -c13-16 | sed ‘/^$/d’} C Core 2 Temp: ${execi 8 sensors | grep -A 1 ‘Core1′ | cut -c13-16 | sed ‘/^$/d’} C

Output:

Conky Dual Core CPU Misc Info

Of course, this should work on any Linux distro with Conky installed.

Hope that helps someone.

written by Hodge \\ tags: , , , , ,

Webloogle Blog Directory