From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,79b8fe58f42020cd,start X-Google-Attributes: gidfee84,public From: Damir Buskulic Subject: Slowdown when dynamically loading a shared lib Date: 1999/03/12 Message-ID: <36E8D082.78ADEAA9@lapp.in2p3.fr>#1/1 X-Deja-AN: 454122085 Content-Transfer-Encoding: 7bit Organization: LAPP Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: comp.unix.osf.osf1 Hello, I'm having a strange problem (for me at least) on OSF 4.0D. I'm using a program that can load dynamically shared libraries (it's called ROOT : http://root.cern.ch). I've build such a library and when I load it dynamically, it is around 10 times slower than if I link it to the executable at compile time. The exact same small routine. The problem boils down to a very simple case described below. Basically, I'm timing the reading of small (255 bytes) bunches of data coming from a file. If I run it standalone, I get most of the time 0 clock ticks (normal...) and sometimes 16666 clock ticks, which is I suppose, normal interruptions of the code coming from time-sharing of the kernel. This happens 10 times out of approx 2500. Now if I load dynamically a shared lib containing the same code and execute that routine, I get 50 times an interruption which is 16666 ticks long. I tried many things, for example changing my libtest.so to read-only. nothing helps. Some behaviour is really strange. On some machines, it depends on the setting of the DISPLAY var (:0.0 fast, blavla:0.0 slow). Did somebody see that kind of behaviour ? Is this something known ? I'm really puzzled. It happens only on Alpha. On Linux/PPC this is not the case. One last thing. I tried to do a simple program loading shared libs with dlopen, and I get this message : "The shared library loader cannot be activated for this process" What should I do to activate the loader ? Cheers Damir ------------------------------------------------------------------------ Here is the code : #include #include #include #include //int main_dada() int main() {int fd; char header [40]; char *buf; unsigned short type; unsigned int length; clock_t t1,t4; fd = open("FR0-26.dat", O_RDONLY, 0644); if(fd < 0) {return (0);} length = 11; while(length> 10) { t1 = clock(); // begin timing buf = malloc(255); if(read(fd, buf, 25) == 0) return(0); free (buf); t4 = clock(); // end timing printf("length=%8d t4 - t1 = %d\n",length,t4-t1); // print it } } -- ===================================================================== | Damir Buskulic | Universite de Savoie/LAPP | | | Chemin de Bellevue, B.P. 110 | | Tel : +33 (0)450091600 | F-74941 Annecy-le-Vieux Cedex | | e-mail: buskulic@lapp.in2p3.fr | FRANCE | ===================================================================== mailto:buskulic@lapp.in2p3.fr