From tobiasu at tmux.org Sun Mar 7 00:14:49 2010 From: tobiasu at tmux.org (Tobias Ulmer) Date: Sun, 7 Mar 2010 00:14:49 +0100 Subject: bogus timing calculation in gcrypts benchmark Message-ID: <20100306231449.GA5356@tin.tmux.org> Hi there, I've had a look at the catastrophic results of gcrypt on BSD systems posted here: http://www.phoronix.com/scan.php?page=article&item=linux_bsd_opensolaris&num=3 It turns out that this is due to a number of bugs in benchmark.c. It uses CLOCKS_PER_SEC, which on BSD systems is the actual tick rate, but on "XSI conformant" systems, it's always 1000000. (Have a look into bits/time.h on a glibc system, the definition violates ANSI C...). The second bug is the "ms" unit, I guess it should haven been "us". If we assume that the unit is microseconds, then there's a 0 too many in the scaling factor. So here's a patch that should be as portable as it gets, with a sane millisecond resolution. Tested on OpenBSD and Linux Tobias PS: please CC --- tests/benchmark.c.orig Thu Apr 2 11:25:34 2009 +++ tests/benchmark.c Sat Mar 6 23:40:05 2010 @@ -27,6 +27,7 @@ #ifdef _WIN32 #include #else +#include #include #endif @@ -332,8 +333,9 @@ t = (t2 - t1)/10000; snprintf (buf, sizeof buf, "%5.0fms", (double)t ); #else + long ticks = sysconf(_SC_CLK_TCK); snprintf (buf, sizeof buf, "%5.0fms", - (((double) (stopped_at - started_at))/CLOCKS_PER_SEC)*10000000); + (((double) (stopped_at - started_at))/ticks)*1000); #endif return buf; } From kuh3h3 at gmail.com Sun Mar 21 03:19:46 2010 From: kuh3h3 at gmail.com (kuh3h3 paulanskaya) Date: Sun, 21 Mar 2010 11:19:46 +0900 Subject: libgcrypt.so: undefined reference to `gpg_err_set_errno' not yet fixed Message-ID: <2264f9311003201919l218d4175h765a1e2feaafa704@mail.gmail.com> i tried to compile recent svn libgcrypt.but failed .what is this error? this error is not yet fixed make[2]: Entering directory `/media/sdc1/new-gpg-src/libgcrypt/tests' /bin/sh ../libtool --tag=CC --mode=link gcc -g -O2 -fvisibility=hidden -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wformat -Wno-format-y2k -Wformat-security -W -Wextra -Wbad-function-cast -Wwrite-strings -Wdeclaration-after-statement -Wno-missing-field-initializers -Wno-sign-compare -Wpointer-arith -o version version.o ../src/libgcrypt.la ../compat/ libcompat.la libtool: link: gcc -g -O2 -fvisibility=hidden -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wformat -Wno-format-y2k -Wformat-security -W -Wextra -Wbad-function-cast -Wwrite-strings -Wdeclaration-after-statement -Wno-missing-field-initializers -Wno-sign-compare -Wpointer-arith -o .libs/version version.o ../src/.libs/libgcrypt.so ../compat/.libs/libcompat.a ../src/.libs/libgcrypt.so: undefined reference to `gpg_err_set_errno' collect2: ld returned 1 exit status make[2]: *** [version] error 1 make[2]: Leaving directory `/media/sdc1/new-gpg-src/libgcrypt/tests' make[1]: *** [all-recursive] error 1 make[1]: Leaving directory `/media/sdc1/new-gpg-src/libgcrypt' make: *** [all] error 2 [/media/sdc1/new-gpg-src/libgpg-error]$ LANG=C svn info Path: . URL: svn://cvs.gnupg.org/libgpg-error/trunk Repository Root: svn://cvs.gnupg.org/libgpg-error Repository UUID: 33590495-dbff-0310-81d2-e26a3b9621c6 Revision: 237 Node Kind: directory Schedule: normal Last Changed Author: wk Last Changed Rev: 237 Last Changed Date: 2010-03-15 21:21:59 +0900 (Mon, 15 Mar 2010) [/media/sdc1/new-gpg-src/libgcrypt]$ LANG=C svn info Path: . URL: svn://cvs.gnupg.org/libgcrypt/trunk Repository Root: svn://cvs.gnupg.org/libgcrypt Repository UUID: 6f2f9801-0afd-0310-a68c-b5e96ad5f9c8 Revision: 1423 Node Kind: directory Schedule: normal Last Changed Author: wk Last Changed Rev: 1423 Last Changed Date: 2010-03-15 21:27:29 +0900 (Mon, 15 Mar 2010) -------------- next part -------------- An HTML attachment was scrubbed... URL: