[Asterisk-Users] optimizing for via C3

Tzafrir Cohen tzafrir at cohens.org.il
Mon Sep 12 09:44:24 MST 2005


Hi

I'm trying to build an Asterisk packages for a C3 system (256MB memory,
cpuinfo below). 

/proc/cpuinfo:
processor       : 0
vendor_id       : CentaurHauls
cpu family      : 6
model           : 9
model name      : VIA Nehemiah
stepping        : 8
cpu MHz         : 1000.736
cache size      : 64 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr mtrr pge cmov pat mmx fxsr sse
rng rng_en ace ace_en
bogomips        : 1961.98

Naturally the first benchmark I'll try is asterisk -rx 'show translation' . 

Here's what I got with a the default 2.6.8-2-386 Debian kernel and my
default unoptimized packages:

         g723   gsm  ulaw  alaw  g726 adpcm  slin lpc10  g729 speex  ilbc
   g723     -     -     -     -     -     -     -     -     -     -     -
    gsm     -     -     7     7    21     7     6    24     -   135    76
   ulaw     -    27     -     1    16     2     1    19     -   130    71
   alaw     -    27     1     -    16     2     1    19     -   130    71
   g726     -    40    15    15     -    15    14    32     -   143    84
  adpcm     -    27     2     2    16     -     1    19     -   130    71
   slin     -    26     1     1    15     1     -    18     -   129    70
  lpc10     -    40    15    15    29    15    14     -     -   143    84
   g729     -     -     -     -     -     -     -     -     -     -     -
  speex     -    32     7     7    21     7     6    24     -     -    76
   ilbc     -    45    20    20    34    20    19    37     -   148     -

Which is quite pathertic, considering a what I get with a junk test machine, 
I get:
         g723   gsm  ulaw  alaw  g726 adpcm  slin lpc10  g729 speex  ilbc
   g723     -     -     -     -     -     -     -     -     -     -     -
    gsm     -     -     7     7    24     8     6    19     -   110    61
   ulaw     -    19     -     1    19     3     1    14     -   105    56
   alaw     -    19     1     -    19     3     1    14     -   105    56
   g726     -    33    16    16     -    17    15    28     -   119    70
  adpcm     -    19     2     2    19     -     1    14     -   105    56
   slin     -    18     1     1    18     2     -    13     -   104    55
  lpc10     -    27    10    10    27    11     9     -     -   113    64
   g729     -     -     -     -     -     -     -     -     -     -     -
  speex     -    23     6     6    23     7     5    18     -     -    60
   ilbc     -    33    16    16    33    17    15    28     -   119     -

That machine has in /proc/cpuinfo:
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 6
model name      : Celeron (Mendocino)
stepping        : 5
cpu MHz         : 501.145
cache size      : 128 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr
bogomips        : 999.42


So I set out to optimize the system.

The easist thing is to build an optimized kernel: built for the "C3" CPU.
(I can send the config and/or complete kernel deb, if you're interested).
This had about zero effect on the output of 'show translation'. 

FWIF: I have still not built a zaptel-modules package for the new
kernel, so Asterisk is running there without a timing source.


I figured that this must be totally user-space and went on to rebuilding 
Asterisk.

I have applied the following patch:
-----------------------------
#! /bin/sh /usr/share/dpatch/dpatch-run
## Makefile_march_c3.dpatch by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: optimizations for C3 CPU.
## DP: Overrides OPTIMIZE. In order for this to work, changes the type of
## DP: CFLGAS

@DPATCH@
diff -urNad asterisk-1.0.9.dfsg.1/Makefile /tmp/dpep.gRvJc9/asterisk-1.0.9.dfsg.
1/Makefile
--- asterisk-1.0.9.dfsg.1/Makefile      2005-09-12 16:00:12.071877432 +0300
+++ /tmp/dpep.gRvJc9/asterisk-1.0.9.dfsg.1/Makefile     2005-09-12 16:09:01.936325792 +0300
@@ -27,7 +27,8 @@
 #K6OPT  = -DK6OPT

 #Tell gcc to optimize the asterisk's code
-OPTIMIZE+=-O2
+OPTIMIZE:=-march=c3
+OPTIMIZE+=-O2

 #Include debug symbols in the executables (-g) and profiling info (-pg)
 DEBUG=-g #-pg
@@ -91,7 +92,7 @@
 AGI_DIR=$(ASTVARLIBDIR)/agi-bin

 INCLUDE=-Iinclude -I../include
-CFLAGS=-pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY
+CFLAGS:=-pipe  -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY
 CFLAGS+=$(OPTIMIZE)

 ifneq ($(PROC),ultrasparc)
--------------------------------
and set 'PROC=c3' instead of 'PROC=i386' as originally set by Debian in
the master makefile (debian/rules) . Random inspection at build time gave 
me the impression that all binaries were built with -march=c3 .

Yet, no improvement at all.

As before, the generated debs and/or source debs/patch are availble upon
request for you to re-run this.

The system is Debian Sarge:

ii  libc6          2.3.2.ds1-22   GNU C Library: Shared libraries and Timezone
ii  gcc            3.3.5-3        The GNU C compiler
ii  libgsm1        1.0.10-13      Shared libraries for GSM speech compressor
ii  libspeex1      1.1.6-2        The Speex Speech Codec


Am I looking at the wrong numbers? If so: what do those numbers mean?
Can anybody suggest useful and simple benchmarks?

-- 
Tzafrir Cohen         | tzafrir at jbr.cohens.org.il | VIM is
http://tzafrir.org.il |                           | a Mutt's  
tzafrir at cohens.org.il |                           |  best
ICQ# 16849755         |                           | friend



More information about the asterisk-users mailing list