K.Suzukiです。
On Thu, 08 Dec 2005 08:29:40 +0900
hirohiro wrote:
HDBENCH Clone を入れてベンチマークしようと思ったら
./configure時に
gtk-configが無いというエラーが出て出来ません。
ちょっと調べて出来たら結果報告させて頂きます。
自分も HDBENCH Clone を x86-64 のマシンでテストして見ようと思って
コンパイルしようとしたのですが、エラーが出て失敗しました。
で、ソースを色々修正してみてうまくいったみたいなのでそのパッチを以下に
貼っておきます。
パッチは 2.6.x & x86-64 専用になっております。:-)
起動と実行は、SUSE Linux 10.0 上で一通り試して動作確認をしました。
ですが、現在まで gtk をあまり使ったこと無いので変な箇所があるかもしれません。
以下に作成方法を書いておきます。
まず、HDBENCH Clone 本体である"hdbench-0.14.0.tar.gz"をダウンロードしてください。
その次に、このメールからパッチをコピペしてファイルに落とします。
ここでは、パッチファイル名を"hdbench-0.14.0-64.patch"とします。
以下のようにパッチを当てます。
$ ls hdbench-0.14.0-64.patch
hdbench-0.14.0-64.patch
$ tar xzf hdbench-0.14.0.tar.gz
$ cd hdbench-0.14.0
$ patch -p1 < ../hdbench-0.14.0-64.patch
次に、UTF-8の日本語環境で起動するため以下を実行します。
$ cd po
$ nkf -w ja.po | sed "s/euc-jp/UTF-8/" > ja2.po
$ mv ja2.po ja.po
$ msgfmt -o ja.gmo ja.po
$ cd ..
で、configure, make, make install をします。
(インストール先を変える場合は、PREFIXを適宜指定してください)
$ ./configure --with-x
$ make
$ su
# make install
以上です。
diff -ruN hdbench-0.14.0/src/benchcpu.s hdbench-0.14.0-fixup/src/benchcpu.s
--- hdbench-0.14.0/src/benchcpu.s 1999-10-06 03:37:02.000000000 +0900
+++ hdbench-0.14.0-fixup/src/benchcpu.s 2005-12-10 01:09:52.338458500 +0900
@@ -27,18 +27,18 @@
.globl bench_integer
.type bench_integer,@function
bench_integer:
- pushl %ebx
- pushl %ecx
- pushl %edx
+ pushq %rbx
+ pushq %rcx
+ pushq %rdx
- xorl %ebx,%ebx
+ xorq %rbx,%rbx
movl $128,%eax
movl $128,b
xorl %edx,%edx
.label1:
movl $300,%ecx
- pushl %ebx
+ pushq %rbx
.label2:
movl a,%ebx
imull b,%ebx
@@ -70,16 +70,16 @@
jnz .label2
- popl %ebx
- incl %ebx
+ popq %rbx
+ incq %rbx
cmpl $1,done_flag
jnz .label1
movl %ebx,%eax
- popl %edx
- popl %ecx
- popl %ebx
+ popq %rdx
+ popq %rcx
+ popq %rbx
ret
@@ -87,9 +87,9 @@
.globl bench_float
.type bench_float,@function
bench_float:
- pushl %ebx
- pushl %ecx
- pushl %edx
+ pushq %rbx
+ pushq %rcx
+ pushq %rdx
xorl %ebx,%ebx
movl $1132462080,a
@@ -131,9 +131,9 @@
movl %ebx,%eax
- popl %edx
- popl %ecx
- popl %ebx
+ popq %rdx
+ popq %rcx
+ popq %rbx
ret
@@ -141,31 +141,33 @@
.globl bench_memory
.type bench_memory,@function
bench_memory:
- pushl %ebp
- movl %esp,%ebp
+ pushq %rbp
+ movq %rsp,%rbp
pushf
- pushl %esi
- pushl %edi
- pushl %ebx
- pushl %ecx
- pushl %edx
+ pushq %rsi
+ pushq %rdi
+ pushq %rbx
+ pushq %rcx
+ pushq %rdx
cld # reset direction flag
xorl %eax,%eax
.label5:
- movl 8(%ebp),%esi # esi <- src
- movl 12(%ebp),%edi # edi <- dest
movl $64,%ecx
.label6:
- pushl %ecx
+ pushq %rcx
+ pushq %rsi
+ pushq %rdi
movl $8192,%ecx # 2MB/4/64
rep
movsl # double word(4bytes)
incl %eax
- popl %ecx
+ popq %rdi
+ popq %rsi
+ popq %rcx
cmp $1,done_flag
jz .label7
@@ -173,14 +175,14 @@
jmp .label5
.label7:
- popl %edx
- popl %ecx
- popl %ebx
- popl %edi
- popl %esi
+ popq %rdx
+ popq %rcx
+ popq %rbx
+ popq %rdi
+ popq %rsi
popf
- movl %ebp,%esp
- popl %ebp
+ movq %rbp,%rsp
+ popq %rbp
ret
diff -ruN hdbench-0.14.0/src/benchmark.c hdbench-0.14.0-fixup/src/benchmark.c
--- hdbench-0.14.0/src/benchmark.c 1999-10-06 21:23:01.000000000 +0900
+++ hdbench-0.14.0-fixup/src/benchmark.c 2005-12-10 02:01:02.670342250 +0900
@@ -533,7 +533,7 @@
gint fd;
gchar *err_mes_temp;
gint i;
- gint32 totalmem,freemem;
+ gint64 totalmem,freemem;
if((fd=open(temp,O_CREAT | O_TRUNC | O_RDWR,S_IRWXU))==-1){
kill(getppid(),SIGTERM);
@@ -544,7 +544,7 @@
g_error(_("Cannot get memory infomation.\n"));
}
- for(i=0;iname,cpu_ptr->vendor,cpu_ptr->family,cpu_ptr->model,cpu_ptr->stepping);
get_osinfo(os_name);
- sprintf(total_mem_str,"%d Bytes",total_mem);
- sprintf(free_mem_str,"%d Bytes",free_mem);
+ sprintf(total_mem_str,"%ld kBytes",total_mem);
+ sprintf(free_mem_str,"%ld kBytes",free_mem);
system_dialog = gtk_dialog_new ();
gtk_object_set_data (GTK_OBJECT (system_dialog), "system_dialog", system_dialog);
@@ -948,125 +949,129 @@
gtk_widget_show (label25);
gtk_box_pack_start (GTK_BOX (vbox5), label25, FALSE, FALSE, 0);
- hbox8 = gtk_hbox_new (FALSE, 0);
- gtk_object_set_data (GTK_OBJECT (system_dialog), "hbox8", hbox8);
- gtk_widget_show (hbox8);
- gtk_box_pack_start (GTK_BOX (vbox5), hbox8, FALSE, TRUE, 0);
-
- label8 = gtk_label_new (_(" CPU"));
- gtk_object_set_data (GTK_OBJECT (system_dialog), "label8", label8);
- gtk_widget_show (label8);
- gtk_box_pack_start (GTK_BOX (hbox8), label8, FALSE, FALSE, 0);
- gtk_widget_set_usize (label8, 100, -2);
- gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5);
-
- label16 = gtk_label_new (":");
- gtk_object_set_data (GTK_OBJECT (system_dialog), "label16", label16);
- gtk_widget_show (label16);
- gtk_box_pack_start (GTK_BOX (hbox8), label16, FALSE, FALSE, 0);
-
- entry_cpu = gtk_entry_new ();
- gtk_object_set_data (GTK_OBJECT (system_dialog), "entry_cpu", entry_cpu);
- gtk_widget_show (entry_cpu);
- gtk_box_pack_start (GTK_BOX (hbox8), entry_cpu, TRUE, TRUE, 5);
- gtk_entry_set_editable (GTK_ENTRY (entry_cpu), FALSE);
- gtk_entry_set_text (GTK_ENTRY (entry_cpu), name);
-
- hbox9 = gtk_hbox_new (FALSE, 0);
- gtk_object_set_data (GTK_OBJECT (system_dialog), "hbox9", hbox9);
- gtk_widget_show (hbox9);
- gtk_box_pack_start (GTK_BOX (vbox5), hbox9, TRUE, TRUE, 0);
-
- label9 = gtk_label_new (_(" Vendor"));
- gtk_object_set_data (GTK_OBJECT (system_dialog), "label9", label9);
- gtk_widget_show (label9);
- gtk_box_pack_start (GTK_BOX (hbox9), label9, FALSE, FALSE, 0);
- gtk_widget_set_usize (label9, 100, -2);
- gtk_misc_set_alignment (GTK_MISC (label9), 0, 0.5);
-
- label18 = gtk_label_new (":");
- gtk_object_set_data (GTK_OBJECT (system_dialog), "label18", label18);
- gtk_widget_show (label18);
- gtk_box_pack_start (GTK_BOX (hbox9), label18, FALSE, FALSE, 0);
-
- entry_vendor = gtk_entry_new ();
- gtk_object_set_data (GTK_OBJECT (system_dialog), "entry_vendor", entry_vendor);
- gtk_widget_show (entry_vendor);
- gtk_box_pack_start (GTK_BOX (hbox9), entry_vendor, TRUE, TRUE, 5);
- gtk_entry_set_editable (GTK_ENTRY (entry_vendor), FALSE);
- gtk_entry_set_text (GTK_ENTRY (entry_vendor), vendor);
-
- hbox10 = gtk_hbox_new (FALSE, 0);
- gtk_object_set_data (GTK_OBJECT (system_dialog), "hbox10", hbox10);
- gtk_widget_show (hbox10);
- gtk_box_pack_start (GTK_BOX (vbox5), hbox10, TRUE, TRUE, 0);
-
- label10 = gtk_label_new (_(" Family"));
- gtk_object_set_data (GTK_OBJECT (system_dialog), "label10", label10);
- gtk_widget_show (label10);
- gtk_box_pack_start (GTK_BOX (hbox10), label10, FALSE, FALSE, 0);
- gtk_widget_set_usize (label10, 100, -2);
- gtk_misc_set_alignment (GTK_MISC (label10), 0, 0.5);
-
- label19 = gtk_label_new (":");
- gtk_object_set_data (GTK_OBJECT (system_dialog), "label19", label19);
- gtk_widget_show (label19);
- gtk_box_pack_start (GTK_BOX (hbox10), label19, FALSE, FALSE, 0);
-
- entry_family = gtk_entry_new ();
- gtk_object_set_data (GTK_OBJECT (system_dialog), "entry_family", entry_family);
- gtk_widget_show (entry_family);
- gtk_box_pack_start (GTK_BOX (hbox10), entry_family, TRUE, TRUE, 5);
- gtk_entry_set_editable (GTK_ENTRY (entry_family), FALSE);
- gtk_entry_set_text (GTK_ENTRY (entry_family), family);
-
- hbox11 = gtk_hbox_new (FALSE, 0);
- gtk_object_set_data (GTK_OBJECT (system_dialog), "hbox11", hbox11);
- gtk_widget_show (hbox11);
- gtk_box_pack_start (GTK_BOX (vbox5), hbox11, TRUE, TRUE, 0);
-
- label11 = gtk_label_new (_(" Model"));
- gtk_object_set_data (GTK_OBJECT (system_dialog), "label11", label11);
- gtk_widget_show (label11);
- gtk_box_pack_start (GTK_BOX (hbox11), label11, FALSE, FALSE, 0);
- gtk_widget_set_usize (label11, 100, -2);
- gtk_misc_set_alignment (GTK_MISC (label11), 0, 0.5);
-
- label20 = gtk_label_new (":");
- gtk_object_set_data (GTK_OBJECT (system_dialog), "label20", label20);
- gtk_widget_show (label20);
- gtk_box_pack_start (GTK_BOX (hbox11), label20, FALSE, FALSE, 0);
-
- entry_model = gtk_entry_new ();
- gtk_object_set_data (GTK_OBJECT (system_dialog), "entry_model", entry_model);
- gtk_widget_show (entry_model);
- gtk_box_pack_start (GTK_BOX (hbox11), entry_model, TRUE, TRUE, 5);
- gtk_entry_set_editable (GTK_ENTRY (entry_model), FALSE);
- gtk_entry_set_text (GTK_ENTRY (entry_model), model);
-
- hbox12 = gtk_hbox_new (FALSE, 0);
- gtk_object_set_data (GTK_OBJECT (system_dialog), "hbox12", hbox12);
- gtk_widget_show (hbox12);
- gtk_box_pack_start (GTK_BOX (vbox5), hbox12, TRUE, TRUE, 0);
-
- label12 = gtk_label_new (_(" Stepping"));
- gtk_object_set_data (GTK_OBJECT (system_dialog), "label12", label12);
- gtk_widget_show (label12);
- gtk_box_pack_start (GTK_BOX (hbox12), label12, FALSE, FALSE, 0);
- gtk_widget_set_usize (label12, 100, -2);
- gtk_misc_set_alignment (GTK_MISC (label12), 0, 0.5);
-
- label21 = gtk_label_new (":");
- gtk_object_set_data (GTK_OBJECT (system_dialog), "label21", label21);
- gtk_widget_show (label21);
- gtk_box_pack_start (GTK_BOX (hbox12), label21, FALSE, FALSE, 0);
-
- entry_stepping = gtk_entry_new ();
- gtk_object_set_data (GTK_OBJECT (system_dialog), "entry_stepping", entry_stepping);
- gtk_widget_show (entry_stepping);
- gtk_box_pack_start (GTK_BOX (hbox12), entry_stepping, TRUE, TRUE, 5);
- gtk_entry_set_editable (GTK_ENTRY (entry_stepping), FALSE);
- gtk_entry_set_text (GTK_ENTRY (entry_stepping), stepping);
+ for (i = 0,cpu_ptr=cpuinfo; i < num_of_cpu; i++,cpu_ptr++) {
+ char tmpbuf[256];
+ hbox8 = gtk_hbox_new (FALSE, 0);
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "hbox8", hbox8);
+ gtk_widget_show (hbox8);
+ gtk_box_pack_start (GTK_BOX (vbox5), hbox8, FALSE, TRUE, 0);
+
+ snprintf(tmpbuf,sizeof(tmpbuf), " CPU %d", i);
+ label8 = gtk_label_new (_(tmpbuf));
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "label8", label8);
+ gtk_widget_show (label8);
+ gtk_box_pack_start (GTK_BOX (hbox8), label8, FALSE, FALSE, 0);
+ gtk_widget_set_usize (label8, 100, -2);
+ gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5);
+
+ label16 = gtk_label_new (":");
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "label16", label16);
+ gtk_widget_show (label16);
+ gtk_box_pack_start (GTK_BOX (hbox8), label16, FALSE, FALSE, 0);
+
+ entry_cpu = gtk_entry_new ();
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "entry_cpu", entry_cpu);
+ gtk_widget_show (entry_cpu);
+ gtk_box_pack_start (GTK_BOX (hbox8), entry_cpu, TRUE, TRUE, 5);
+ gtk_entry_set_editable (GTK_ENTRY (entry_cpu), FALSE);
+ gtk_entry_set_text (GTK_ENTRY (entry_cpu), cpu_ptr->name);
+
+ hbox9 = gtk_hbox_new (FALSE, 0);
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "hbox9", hbox9);
+ gtk_widget_show (hbox9);
+ gtk_box_pack_start (GTK_BOX (vbox5), hbox9, TRUE, TRUE, 0);
+
+ label9 = gtk_label_new (_(" Vendor"));
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "label9", label9);
+ gtk_widget_show (label9);
+ gtk_box_pack_start (GTK_BOX (hbox9), label9, FALSE, FALSE, 0);
+ gtk_widget_set_usize (label9, 100, -2);
+ gtk_misc_set_alignment (GTK_MISC (label9), 0, 0.5);
+
+ label18 = gtk_label_new (":");
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "label18", label18);
+ gtk_widget_show (label18);
+ gtk_box_pack_start (GTK_BOX (hbox9), label18, FALSE, FALSE, 0);
+
+ entry_vendor = gtk_entry_new ();
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "entry_vendor", entry_vendor);
+ gtk_widget_show (entry_vendor);
+ gtk_box_pack_start (GTK_BOX (hbox9), entry_vendor, TRUE, TRUE, 5);
+ gtk_entry_set_editable (GTK_ENTRY (entry_vendor), FALSE);
+ gtk_entry_set_text (GTK_ENTRY (entry_vendor), cpu_ptr->vendor);
+
+ hbox10 = gtk_hbox_new (FALSE, 0);
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "hbox10", hbox10);
+ gtk_widget_show (hbox10);
+ gtk_box_pack_start (GTK_BOX (vbox5), hbox10, TRUE, TRUE, 0);
+
+ label10 = gtk_label_new (_(" Family"));
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "label10", label10);
+ gtk_widget_show (label10);
+ gtk_box_pack_start (GTK_BOX (hbox10), label10, FALSE, FALSE, 0);
+ gtk_widget_set_usize (label10, 100, -2);
+ gtk_misc_set_alignment (GTK_MISC (label10), 0, 0.5);
+
+ label19 = gtk_label_new (":");
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "label19", label19);
+ gtk_widget_show (label19);
+ gtk_box_pack_start (GTK_BOX (hbox10), label19, FALSE, FALSE, 0);
+
+ entry_family = gtk_entry_new ();
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "entry_family", entry_family);
+ gtk_widget_show (entry_family);
+ gtk_box_pack_start (GTK_BOX (hbox10), entry_family, TRUE, TRUE, 5);
+ gtk_entry_set_editable (GTK_ENTRY (entry_family), FALSE);
+ gtk_entry_set_text (GTK_ENTRY (entry_family), cpu_ptr->family);
+
+ hbox11 = gtk_hbox_new (FALSE, 0);
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "hbox11", hbox11);
+ gtk_widget_show (hbox11);
+ gtk_box_pack_start (GTK_BOX (vbox5), hbox11, TRUE, TRUE, 0);
+
+ label11 = gtk_label_new (_(" Model"));
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "label11", label11);
+ gtk_widget_show (label11);
+ gtk_box_pack_start (GTK_BOX (hbox11), label11, FALSE, FALSE, 0);
+ gtk_widget_set_usize (label11, 100, -2);
+ gtk_misc_set_alignment (GTK_MISC (label11), 0, 0.5);
+
+ label20 = gtk_label_new (":");
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "label20", label20);
+ gtk_widget_show (label20);
+ gtk_box_pack_start (GTK_BOX (hbox11), label20, FALSE, FALSE, 0);
+
+ entry_model = gtk_entry_new ();
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "entry_model", entry_model);
+ gtk_widget_show (entry_model);
+ gtk_box_pack_start (GTK_BOX (hbox11), entry_model, TRUE, TRUE, 5);
+ gtk_entry_set_editable (GTK_ENTRY (entry_model), FALSE);
+ gtk_entry_set_text (GTK_ENTRY (entry_model), cpu_ptr->model);
+
+ hbox12 = gtk_hbox_new (FALSE, 0);
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "hbox12", hbox12);
+ gtk_widget_show (hbox12);
+ gtk_box_pack_start (GTK_BOX (vbox5), hbox12, TRUE, TRUE, 0);
+
+ label12 = gtk_label_new (_(" Stepping"));
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "label12", label12);
+ gtk_widget_show (label12);
+ gtk_box_pack_start (GTK_BOX (hbox12), label12, FALSE, FALSE, 0);
+ gtk_widget_set_usize (label12, 100, -2);
+ gtk_misc_set_alignment (GTK_MISC (label12), 0, 0.5);
+
+ label21 = gtk_label_new (":");
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "label21", label21);
+ gtk_widget_show (label21);
+ gtk_box_pack_start (GTK_BOX (hbox12), label21, FALSE, FALSE, 0);
+
+ entry_stepping = gtk_entry_new ();
+ gtk_object_set_data (GTK_OBJECT (system_dialog), "entry_stepping", entry_stepping);
+ gtk_widget_show (entry_stepping);
+ gtk_box_pack_start (GTK_BOX (hbox12), entry_stepping, TRUE, TRUE, 5);
+ gtk_entry_set_editable (GTK_ENTRY (entry_stepping), FALSE);
+ gtk_entry_set_text (GTK_ENTRY (entry_stepping), cpu_ptr->stepping);
+ }
label26 = gtk_label_new ("");
gtk_object_set_data (GTK_OBJECT (system_dialog), "label26", label26);
@@ -1176,6 +1181,8 @@
gtk_window_set_modal(GTK_WINDOW(system_dialog), TRUE);
+ g_free(cpuinfo);
+
return system_dialog;
}
diff -ruN hdbench-0.14.0/src/proto.h hdbench-0.14.0-fixup/src/proto.h
--- hdbench-0.14.0/src/proto.h 1999-10-06 20:50:43.000000000 +0900
+++ hdbench-0.14.0-fixup/src/proto.h 2005-12-09 22:26:03.905139750 +0900
@@ -25,6 +25,7 @@
#include
#include
+#include
#include
@@ -70,8 +71,8 @@
/* getinfo.c */
-gint get_meminfo(gint32 *totalmem,gint32 *freemem);
-void get_cpuinfo(char *name,char *vendor,char *family,char *model,char *stepping);
+gint get_meminfo(gint64 *totalmem,gint64 *freemem);
+void get_cpuinfo(gint ncpu,char *name,char *vendor,char *family,char *model,char *stepping);
void get_osinfo(char *name);
guint32 lpow(gint x,gint y);
char *get_display_name(void);
@@ -193,5 +194,7 @@
const gchar *filename);
+gint get_num_of_cpu(void);
+
#endif /* PROTO_H_INCLUDED */
diff -ruN hdbench-0.14.0/src/sighandler.c hdbench-0.14.0-fixup/src/sighandler.c
--- hdbench-0.14.0/src/sighandler.c 1999-10-06 20:54:04.000000000 +0900
+++ hdbench-0.14.0-fixup/src/sighandler.c 2005-12-10 12:12:29.937164750 +0900
@@ -55,56 +55,86 @@
gchar *format_result(void)
{
- gchar name[128];
- gchar vendor[64];
- gchar family[64];
- gchar model[64];
- gchar stepping[64];
gchar os_name[64];
- gint32 freemem,totalmem;
+ gint64 freemem,totalmem;
struct tm *nowtime;
time_t t;
gchar *machine_info1,*machine_info2,*bench_result;
gchar *display_name;
gchar *drive_data;
gchar *formated;
+ CPUINFO *cpuinfo, *cpu_ptr;
+ gint num_of_cpu;
+ gint i;
+ num_of_cpu = get_num_of_cpu();
+ cpuinfo=g_malloc(sizeof(CPUINFO)*num_of_cpu);
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(opt_resultonly))){
- formated=g_strdup_printf("%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d %s:%dMB\n"
+ formated=g_strdup_printf("%6d %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d %s:%dMB\n"
,result_all,result_float,result_integer,result_memory,
result_rectangle,result_circle,result_text,result_scroll,result_image,
result_read,result_write,
disk_drive,disk_capacity);
}else{
- get_cpuinfo(name,vendor,family,model,stepping);
+ for(i = 0, cpu_ptr=cpuinfo; i < num_of_cpu; i++, cpu_ptr++)
+ get_cpuinfo(i,cpu_ptr->name,cpu_ptr->vendor,cpu_ptr->family,cpu_ptr->model,cpu_ptr->stepping);
get_osinfo(os_name);
get_meminfo(&totalmem,&freemem);
t=time(NULL);
nowtime=localtime(&t);
+ if(num_of_cpu == 1) {
machine_info1=g_strdup_printf("\
* * * HDBENCH clone Ver %s * * *\n\
Machine Infomation\n\
Processor %s\n\
Vendor %s Family %s Model %s Stepping %s\n\
Resolution %dx%d %ucolors(%dbit)\n",
-VERSION,name,vendor,family,model,stepping,
+VERSION,cpuinfo->name,cpuinfo->vendor,cpuinfo->family,cpuinfo->model,cpuinfo->stepping,
DisplayWidth(GDK_DISPLAY(),DefaultScreen(GDK_DISPLAY())),
DisplayHeight(GDK_DISPLAY(),DefaultScreen(GDK_DISPLAY())),
lpow(2,DefaultDepth(GDK_DISPLAY(),DefaultScreen(GDK_DISPLAY()))),
DefaultDepth(GDK_DISPLAY(),DefaultScreen(GDK_DISPLAY())));
+ }else{
+ gchar *tmpstr1,*tmpstr2;
+
+ machine_info1=g_strdup_printf("\
+* * * HDBENCH clone Ver %s * * *\n\
+Machine Infomation\n", VERSION);
+ for (i=0, cpu_ptr=cpuinfo; i < num_of_cpu; i++, cpu_ptr++) {
+ tmpstr1=g_strdup_printf(
+"Processor %d %s\n\
+ Vendor %s Family %s Model %s Stepping %s\n",
+ i, cpu_ptr->name,cpu_ptr->vendor,cpu_ptr->family,cpu_ptr->model,cpu_ptr->stepping);
+ tmpstr2=g_strconcat(machine_info1,tmpstr1,NULL);
+ g_free(machine_info1);
+ g_free(tmpstr1);
+ machine_info1=tmpstr2;
+ }
+ tmpstr1=g_strdup_printf(
+"Resolution %dx%d %ucolors(%dbit)\n",
+DisplayWidth(GDK_DISPLAY(),DefaultScreen(GDK_DISPLAY())),
+DisplayHeight(GDK_DISPLAY(),DefaultScreen(GDK_DISPLAY())),
+lpow(2,DefaultDepth(GDK_DISPLAY(),DefaultScreen(GDK_DISPLAY()))),
+DefaultDepth(GDK_DISPLAY(),DefaultScreen(GDK_DISPLAY())));
+ tmpstr2=g_strconcat(machine_info1,tmpstr1,NULL);
+ g_free(machine_info1);
+ g_free(tmpstr1);
+ machine_info1=tmpstr2;
+ }
+
machine_info2=g_strdup_printf("\
-Memory %dKBytes\n\
+Memory %ldKBytes\n\
OS %s\n\
Date %d/%02d/%02d %02d:%02d\n\n",
-totalmem/1024,os_name,
+totalmem,os_name,
nowtime->tm_year+1900,nowtime->tm_mon+1,nowtime->tm_mday,nowtime->tm_hour,nowtime->tm_min);
bench_result=g_strdup_printf("\
TOTAL FLOAT INTGR MEMRY RECT CIRCL TEXT SCRL IMAGE READ WRITE DRIVE\n\
-%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d %s:%dMB\n",
+%6d %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d %s:%dMB\n",
result_all,result_float,result_integer,result_memory,
result_rectangle,result_circle,result_text,result_scroll,result_image,
result_read,result_write,
@@ -126,6 +156,7 @@
g_free(machine_info2);
g_free(bench_result);
}
+ g_free(cpuinfo);
return(formated);
}
@@ -274,29 +305,56 @@
on_system_copy_button_clicked (GtkButton *button,
gpointer user_data)
{
- gchar name[128];
- gchar vendor[64];
- gchar family[64];
- gchar model[64];
- gchar stepping[64];
gchar os_name[64];
-
- get_cpuinfo(name,vendor,family,model,stepping);
+ CPUINFO *cpuinfo, *cpu_ptr;
+ gint num_of_cpu;
+ gint i;
+ char *buftmp1,*buftmp2;
+ gint64 total_mem,free_mem;
+ gchar total_mem_str[64],free_mem_str[64];
+
+ num_of_cpu = get_num_of_cpu();
+ cpuinfo=g_malloc(sizeof(CPUINFO)*num_of_cpu);
+ for(i = 0, cpu_ptr=cpuinfo; i < num_of_cpu; i++, cpu_ptr++)
+ get_cpuinfo(i,cpu_ptr->name,cpu_ptr->vendor,cpu_ptr->family,cpu_ptr->model,cpu_ptr->stepping);
get_osinfo(os_name);
+ get_meminfo(&total_mem,&free_mem);
+ sprintf(total_mem_str,"%ld kBytes",total_mem);
+ sprintf(free_mem_str,"%ld kBytes",free_mem);
if(selection_buffer!=NULL){
g_free(selection_buffer);
selection_buffer=NULL;
}
selection_buffer=g_strdup_printf("** HDBENCH clone Ver %s **\n\
-OS %s\n\
+OS %s\n",VERSION,os_name);
+ for (i = 0, cpu_ptr=cpuinfo; i < num_of_cpu; i++, cpu_ptr++) {
+ buftmp1=g_strdup_printf("\
+\n\
CPU %s\n\
Vendor %s\n\
Family %s\n\
Model %s\n\
-Stepping %s\n",VERSION,os_name,name,vendor,family,model,stepping);
+Stepping %s\n",
+cpu_ptr->name,cpu_ptr->vendor,cpu_ptr->family,cpu_ptr->model,cpu_ptr->stepping);
+ buftmp2=g_strconcat(selection_buffer,buftmp1,NULL);
+ g_free(selection_buffer);
+ g_free(buftmp1);
+ selection_buffer=buftmp2;
+ }
+ buftmp1=g_strdup_printf("\
+\n\
+Memory\n\
+Total %s kBytes\n\
+Free %s kBytes\n",
+total_mem_str,free_mem_str);
+ buftmp2=g_strconcat(selection_buffer,buftmp1,NULL);
+ g_free(selection_buffer);
+ g_free(buftmp1);
+ selection_buffer=buftmp2;
gtk_selection_owner_set (main_window,GDK_SELECTION_PRIMARY,GDK_CURRENT_TIME);
+ g_free(cpuinfo);
}
diff -ruN hdbench-0.14.0/src/support.c hdbench-0.14.0-fixup/src/support.c
--- hdbench-0.14.0/src/support.c 1999-10-06 20:52:55.000000000 +0900
+++ hdbench-0.14.0-fixup/src/support.c 2005-12-10 12:24:58.627955000 +0900
@@ -175,3 +175,15 @@
return NULL;
}
+gint get_num_of_cpu()
+{
+ FILE *fp;
+ static char buf[8];
+
+ fp = popen("cat /proc/cpuinfo|grep ^processor|wc -l", "r");
+ if (fp == NULL)
+ g_error ("Couldn't get number of cpu.");
+ fread(buf, 1, sizeof(buf), fp);
+ pclose(fp);
+ return atoi(buf);
+}
diff -ruN hdbench-0.14.0/src/variable.h hdbench-0.14.0-fixup/src/variable.h
--- hdbench-0.14.0/src/variable.h 1999-10-06 03:36:37.000000000 +0900
+++ hdbench-0.14.0-fixup/src/variable.h 2005-12-10 02:19:10.962356250 +0900
@@ -55,6 +55,14 @@
gint32 write;
};
+typedef struct {
+ gchar name[128];
+ gchar vendor[64];
+ gchar family[64];
+ gchar model[64];
+ gchar stepping[64];
+}CPUINFO;
+
GLOBAL gint done_flag;
GLOBAL gint disk_capacity GLOBAL_VAL(10);
GLOBAL gchar *font_name GLOBAL_VAL("-adobe-helvetica-medium-r-*--14-*");