Hi Carl

> Running Thunderbird 15.0.1 on Ubuntu 10.4 (Please don't suggest
> changing my email client or Linux to your current favourites.)

10.04 is very old though (almost 3 years now), and no longer receives even 
security updates - hasn't for over a year. So just upgrading Ubuntu would be a 
good idea. But that's as an aside.


> Thunderbird is doing a major re-indexing of messages, which is really
> pushing my CPU to its limits. (i.e. getting over 60C core temperature,
> email process using 100-160% of CPU usage - dual core CPU)
> 
> Full details of my hardware, and the CPU usage are documented here:
> http://forums.mozillazine.org/viewtopic.php?f=31&t=2399189
> 
> That was this time last year. Doing the same thing now with my updated
> version of TB. (Only happens for a couple days, once a year, when I
> shift all my Sent messages of the previous calendar year to an
> "archive"
> folder.)
> 
> Could any of you point me to instructions to get Ubuntu to limit or
> choke the demand that the Thunderbird process calls upon the CPU?

I use the following script to run RuneScape (a game implemented in Java) on 
Linux.
It figures out how many cores a machine has, and then binds the process to 
all-but-one.
It's not perfect, but as long as you don't do this with more of your apps, it 
tends to have the desired effect.
Script pasted below, adapt to your needs / use as a template for what you need.

(for the bash experts among the LUV readers - I'm not one of you so I'm certain 
the above is less than efficient. It does, however, do the job)

===
#!/bin/bash

# 2012-05-21 by Arjen Lentz <a r j e n (at) l e n t z (dot) c o m (dot) a u>

# Note: the following is Linux specific
# requires bash 4, taskset, /proc/cpuinfo, egrep, wc

# Binding a process to all but N cores using taskset
# (note that core numbers are 0 based)
# taskset -c 0,1,2 can also be written as -c 0-2
# taskset is either followed by a commandline to start, or --pid N

# set this to 1, or higher if you need more spare cores
SPARECORES=1
# if successful TASKSET_CMD will contain something like
# "/usr/bin/taskset -c 1-3"
# If not, TASKSET_CMD will be an empty string.

CPUINFO="/proc/cpuinfo"
TASKSET_CMD=""

# extended grep tool so we can use a decent regex
EGREP=`which egrep`
if [[ -z $EGREP ]]; then
   echo "egrep command not installed, skipping taskset"
else
   # wordcount tool
   WC=`which wc`
   if [[ -z $WC ]]; then
      echo "wc command not installed, skipping taskset"
   else
      # taskset tool
      TASKSET=`which taskset`
      if [[ -z $TASKSET ]]; then
         echo "taskset command not installed"
      else
         if [[ -a $CPUINFO ]]; then
            # NCORES will be set to the actual number of cores
            NCORES=`$EGREP "^processor\s" $CPUINFO | $WC -l`
            if [[ $NCORES > $SPARECORES ]]; then
               echo "Detected $NCORES CPU cores, keeping $SPARECORES spare"
               # TASKSET_CMD will set to all except SPARECORES
               TASKSET_CMD="$TASKSET -c $SPARECORES-$((NCORES-1))"
# following echo is just for debug purposes
#              echo $TASKSET_CMD ...
            else
               echo "Detected cores $NCORES <= $SPARECORES requested, skipping 
taskset"
            fi
         else
            echo "$CPUINFO not found, skipping taskset"
         fi
      fi
   fi
fi

JAVA=`which java`
# initial and maximum amount of memory the Java process is allowed to allocate
# note that in the 64bit section below, maxmem is raised
INITMEM=1000M
MAXMEM=2500M
# Default to 32-bit environment, as that always works
JAVAOPTS="-server -d32 -Xms$INITMEM -Xmx$MAXMEM -XX:+UseParallelOldGC 
-XX:ParallelGCThreads=1 -XX:+DoEscapeAnalysis"
# uname tool
UNAME=`which uname`
if [[ -z $UNAME ]]; then
   echo "uname command not installed, so can't check architecture - defaulting 
to 32-bit"
else
  ARCH=`$UNAME -m`
  if [[ $ARCH = 'x86_64' ]]; then
    echo "Architecture $ARCH, selecting 64-bit environment"
    MAXMEM=3000M
    JAVAOPTS="-server -d64 -Xms$INITMEM -Xmx$MAXMEM -XX:+UseParallelOldGC 
-XX:ParallelGCThreads=1 -XX:+DoEscapeAnalysis -XX:+UseCompressedOops"
  else
    echo "Architecture $ARCH, defaulting to 32-bit"
  fi
fi

RUNESCAPEDIR="$HOME/runescape"
CLASSPATH="$RUNESCAPEDIR/bin/jagexappletviewer.jar"
CONFIG=$'http://www.runescape.com/k=3/l=en/jav_config.ws'
LOGFILE=$RUNESCAPEDIR/runescape.log
CMDLINE="$TASKSET_CMD $JAVA $JAVAOPTS -Djava.class.path=$CLASSPATH 
-Dcom.jagex.config=$CONFIG jagexappletviewer ./images"
echo >>$LOGFILE
echo >>$LOGFILE =====
echo >>$LOGFILE `date`
echo >>$LOGFILE $CMDLINE
echo >>$LOGFILE
# we cd to this dir so any Java segfault logs will also be contained there
# (rather than getting lost in homedir)
cd $RUNESCAPEDIR
$CMDLINE >>$LOGFILE 2>&1
===


-- 
Exec.Director @ Open Query (http://openquery.com) MySQL services
Sane business strategy explorations at http://upstarta.com.au
Personal blog at http://lentz.com.au/blog/
_______________________________________________
luv-main mailing list
[email protected]
http://lists.luv.asn.au/listinfo/luv-main

Reply via email to