Erlang Mailing Lists

Author Message

<  Erlang patches mailing list  ~  lots of uname syscalls on boot - patch

davidw at dedasys.com (Da
Posted: Mon May 03, 2004 10:08 am Reply with quote
Guest
[ Please CC replies to me. ]

Hi,

I'm pretty new to Erlang, so maybe there is a good reason for this
behavior, but I noticed that when starting up, erlang calls uname (2)
a lot:

davidw_at_coosbay:~$ strace -o output erl ./hw.erl -noinput -s hw main
hello world
davidw_at_coosbay:~$ grep -c uname output
982

I had a go at reducing that in ./erts/emulator/sys/unix/sys.c:

void
os_flavor(char* namebuf, /* Where to return the name. */
unsigned size) /* Size of name buffer. */
{
static int called = 0;
static struct utsname uts; /* Information about the system. */

if (called != 1) {
(void) uname(&uts);
called = 1;
}
strcpy(namebuf, uts.sysname);
for ( ; *namebuf; namebuf++)
if (isupper((int) *namebuf))
*namebuf = tolower((int) *namebuf);
}

This change drammatically reduces the amount of uname syscalls:

davidw_at_coosbay:~$ strace -o output /home/davidw/download/erlang-9.2/bin/erl ./hw.erl -noinput -s hw main
hello world
davidw_at_coosbay:~$ grep -c uname output
6

It's not that big a deal I guess, but I suppose it speeds things up
just a bit.

Thankyou,
--
David N. Welton
Consulting: http://www.dedasys.com/
Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
Apache Tcl: http://tcl.apache.org/


Post generated using Mail2Forum (http://m2f.sourceforge.net)

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum