libMicroが動かないわけだが

OpenSolarisで、libMicroが動かない。というか、セグメンテーションフォールトする。


$ wget http://opensolaris.org/os/project/libmicro/files/libmicro-0.4.0.tar.gz
$ gzip -cd libmicro-0.4.0.tar.gz | tar xf -
$ cd libMicro-0.4.0/
$ make
$ ./bench > output
./bench: line 34: 12943: Memory fault(coredump)
$
$ bin/tattle -V
Segmentation Fault (core dumped)
$ pfexec bin/tattle -V
Segmentation Fault (core dumped)
$

理由が、すごいどうでもいい。

○今のOpenSolaris環境


$ cc -V 2>&1 | egrep Sun
cc: Sun Ceres C 5.10 SunOS_i386 2008/10/22
Solaris10環境

$ cc -V 2>&1 | egrep Sun
cc: Sun C 5.8 2005/10/13

上のコンパイラのバージョン情報の文字列の長さが30超えているから。。。


$vi tattle.c
...
int
main(int argc, char *argv[])
{
int c;

if (strlen(compiler_version) > 30)
compiler_version[30] = 0;

上の 30 をとりあえず50にする or strlenの2行をコメントアウトするで動くようになる。
多分、影響するのは出力結果のコンパイルバージョンの行の長さを合わせているだけではないかと?
(右にハミデマス。)


$ ./bench > output
...
$ more output
...
!Compiler: cc
!Compiler Ver.:cc: Sun Ceres C 5.10 SunOS_i386 2008/10/22
!sizeof(long): 4
...

で、Atom330 (デュアルコア)+HyperThreading で4CPUに見えるわけだですが、400%まで使えるのか?


$ bin-i86pc/malloc -D 100000 -P 4 &

$ mpstat 1
...
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
0 1 0 0 341 101 1498 47 12 139 0 981 93 4 0 3
1 1 0 3 255 110 1534 36 18 168 0 985 94 3 0 3
2 1 0 3 156 100 1580 52 21 172 0 1531 95 3 0 2
3 1 0 0 59 11 1477 43 26 215 0 1028 96 2 0 2
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
0 1 0 0 333 103 1490 31 22 154 0 1006 95 3 0 2
1 1 0 3 252 106 1476 36 16 171 0 980 93 3 0 4
2 1 0 0 175 112 1525 60 22 185 0 1285 93 2 0 5
3 1 0 6 68 18 1536 40 23 170 0 1270 94 2 0 4
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
0 1 0 0 337 103 1522 38 14 148 0 1012 95 3 0 2
1 1 0 3 251 107 1495 33 11 191 0 1017 96 2 0 2
2 1 0 0 147 94 1543 48 12 172 0 1241 95 3 0 2
3 1 0 3 76 19 1513 39 7 174 0 1225 94 3 0 3
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
...

おぉ、素晴らしいじゃないか。
昔はよく HT 使っても ニセCPUで、80% ぐらいしか上がらないんですよね?、と言われたことがあったんですが、ハテ?