gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r4265 - GNUnet/src/util/crypto


From: grothoff
Subject: [GNUnet-SVN] r4265 - GNUnet/src/util/crypto
Date: Mon, 8 Jan 2007 20:05:33 -0800 (PST)

Author: grothoff
Date: 2007-01-08 20:05:32 -0800 (Mon, 08 Jan 2007)
New Revision: 4265

Added:
   GNUnet/src/util/crypto/hashperf.c
Modified:
   GNUnet/src/util/crypto/Makefile.am
Log:
hp

Modified: GNUnet/src/util/crypto/Makefile.am
===================================================================
--- GNUnet/src/util/crypto/Makefile.am  2007-01-09 04:00:36 UTC (rev 4264)
+++ GNUnet/src/util/crypto/Makefile.am  2007-01-09 04:05:32 UTC (rev 4265)
@@ -24,6 +24,7 @@
 check_PROGRAMS = \
  crctest \
  hashtest \
+ hashperf \
  hashingtest \
  hostkeytest \
  kblockkey_test \
@@ -62,6 +63,12 @@
  $(top_builddir)/src/util/libgnunetutil.la \
  $(top_builddir)/src/util/crypto/libgnunetutil_crypto.la  
 
+hashperf_SOURCES = \
+ hashperf.c
+hashperf_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/util/crypto/libgnunetutil_crypto.la  
+
 symciphertest_SOURCES = \
  symciphertest.c
 symciphertest_LDADD = \

Added: GNUnet/src/util/crypto/hashperf.c
===================================================================
--- GNUnet/src/util/crypto/hashperf.c   2007-01-09 04:00:36 UTC (rev 4264)
+++ GNUnet/src/util/crypto/hashperf.c   2007-01-09 04:05:32 UTC (rev 4265)
@@ -0,0 +1,66 @@
+/*
+     This file is part of GNUnet.
+     (C) 2002, 2003, 2004, 2006 Christian Grothoff (and other contributing 
authors)
+
+     GNUnet is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published
+     by the Free Software Foundation; either version 2, or (at your
+     option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with GNUnet; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * Test for hashing.c
+ * @author Christian Grothoff
+ * @file util/crypto/hashperf.c
+ */
+
+#include "gnunet_util.h"
+#include "gnunet_util_crypto.h"
+#include "platform.h"
+
+static void perfHash() {
+  HashCode512 hc1;
+  HashCode512 hc2;
+  HashCode512 hc3;
+  int i;
+  char * buf;
+
+  buf = MALLOC(1024*64);
+  memset(buf, 1, 1024 * 64);
+  hash("foo", 3, &hc1);
+  for (i=0;i<1024*1024;i++) {
+    hash(&hc1, 
+        sizeof(HashCode512),
+        &hc2);
+    hash(&hc2, 
+        sizeof(HashCode512),
+        &hc1);
+    hash(buf,
+        1024 * 64,
+        &hc3);
+  }
+}
+
+int main(int argc, char * argv[]) {
+  int i;
+  cron_t start;
+
+  start = get_time();
+  for (i=0;i<10;i++)
+    perfHash();
+  printf("Hash perf took %llu ms\n",
+        get_time() - start);
+  return 0;
+}
+
+/* end of hashperf.c */


Property changes on: GNUnet/src/util/crypto/hashperf.c
___________________________________________________________________
Name: svn:eol-style
   + native





reply via email to

[Prev in Thread] Current Thread [Next in Thread]