aboutsummaryrefslogtreecommitdiff
path: root/src/peerinfo/perf_peerinfo_api.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-15 21:54:06 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-15 21:54:06 +0000
commit5746309cb4be2073d550ad7a6885e918631dbc38 (patch)
tree89455bc4aadf977816b38df13f990372cd81d71a /src/peerinfo/perf_peerinfo_api.c
parent6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff)
downloadgnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz
gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip
indentation
Diffstat (limited to 'src/peerinfo/perf_peerinfo_api.c')
-rwxr-xr-xsrc/peerinfo/perf_peerinfo_api.c50
1 files changed, 23 insertions, 27 deletions
diff --git a/src/peerinfo/perf_peerinfo_api.c b/src/peerinfo/perf_peerinfo_api.c
index d0eadaf94..d9107c8fe 100755
--- a/src/peerinfo/perf_peerinfo_api.c
+++ b/src/peerinfo/perf_peerinfo_api.c
@@ -47,9 +47,7 @@ static struct GNUNET_PEERINFO_Handle *h;
47static unsigned int numpeers; 47static unsigned int numpeers;
48 48
49static int 49static int
50check_it (void *cls, 50check_it (void *cls, const char *tname, struct GNUNET_TIME_Absolute expiration,
51 const char *tname,
52 struct GNUNET_TIME_Absolute expiration,
53 const void *addr, uint16_t addrlen) 51 const void *addr, uint16_t addrlen)
54{ 52{
55#if DEBUG 53#if DEBUG
@@ -74,10 +72,11 @@ address_generator (void *cls, size_t max, void *buf)
74 72
75 GNUNET_asprintf (&address, "Address%d", *agc); 73 GNUNET_asprintf (&address, "Address%d", *agc);
76 74
77 ret = GNUNET_HELLO_add_address ("peerinfotest", 75 ret =
78 GNUNET_TIME_relative_to_absolute 76 GNUNET_HELLO_add_address ("peerinfotest",
79 (GNUNET_TIME_UNIT_HOURS), 77 GNUNET_TIME_relative_to_absolute
80 address, strlen (address) + 1, buf, max); 78 (GNUNET_TIME_UNIT_HOURS), address,
79 strlen (address) + 1, buf, max);
81 GNUNET_free (address); 80 GNUNET_free (address);
82 *agc = 0; 81 *agc = 0;
83 return ret; 82 return ret;
@@ -100,8 +99,7 @@ add_peer (size_t i)
100 99
101 100
102static void 101static void
103process (void *cls, 102process (void *cls, const struct GNUNET_PeerIdentity *peer,
104 const struct GNUNET_PeerIdentity *peer,
105 const struct GNUNET_HELLO_Message *hello, const char *err_msg) 103 const struct GNUNET_HELLO_Message *hello, const char *err_msg)
106{ 104{
107 if (peer == NULL) 105 if (peer == NULL)
@@ -124,9 +122,8 @@ process (void *cls,
124 122
125 123
126static void 124static void
127run (void *cls, 125run (void *cls, char *const *args, const char *cfgfile,
128 char *const *args, 126 const struct GNUNET_CONFIGURATION_Handle *c)
129 const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
130{ 127{
131 size_t i; 128 size_t i;
132 129
@@ -136,11 +133,10 @@ run (void *cls,
136 for (i = 0; i < NUM_REQUESTS; i++) 133 for (i = 0; i < NUM_REQUESTS; i++)
137 { 134 {
138 add_peer (i); 135 add_peer (i);
139 ic[i] = GNUNET_PEERINFO_iterate (h, 136 ic[i] =
140 NULL, 137 GNUNET_PEERINFO_iterate (h, NULL,
141 GNUNET_TIME_relative_multiply 138 GNUNET_TIME_relative_multiply
142 (GNUNET_TIME_UNIT_SECONDS, 30), 139 (GNUNET_TIME_UNIT_SECONDS, 30), &process, cls);
143 &process, cls);
144 } 140 }
145} 141}
146 142
@@ -165,21 +161,21 @@ check ()
165 struct GNUNET_GETOPT_CommandLineOption options[] = { 161 struct GNUNET_GETOPT_CommandLineOption options[] = {
166 GNUNET_GETOPT_OPTION_END 162 GNUNET_GETOPT_OPTION_END
167 }; 163 };
168 proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-peerinfo", 164 proc =
169 "gnunet-service-peerinfo", 165 GNUNET_OS_start_process (NULL, NULL, "gnunet-service-peerinfo",
166 "gnunet-service-peerinfo",
170#if DEBUG_PEERINFO 167#if DEBUG_PEERINFO
171 "-L", "DEBUG", 168 "-L", "DEBUG",
172#else 169#else
173 "-L", "ERROR", 170 "-L", "ERROR",
174#endif 171#endif
175 "-c", "test_peerinfo_api_data.conf", NULL); 172 "-c", "test_peerinfo_api_data.conf", NULL);
176#endif 173#endif
177 GNUNET_assert (NULL != proc); 174 GNUNET_assert (NULL != proc);
178 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, 175 GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
179 argv, "perf-peerinfo-api", "nohelp", options, &run, &ok); 176 "perf-peerinfo-api", "nohelp", options, &run, &ok);
180 fprintf (stderr, 177 fprintf (stderr, "Received %u/%u calls before timeout\n", numpeers,
181 "Received %u/%u calls before timeout\n", 178 NUM_REQUESTS * NUM_REQUESTS / 2);
182 numpeers, NUM_REQUESTS * NUM_REQUESTS / 2);
183 GAUGER ("PEERINFO", "Peerinfo lookups", numpeers / 30, "peers/s"); 179 GAUGER ("PEERINFO", "Peerinfo lookups", numpeers / 30, "peers/s");
184#if START_SERVICE 180#if START_SERVICE
185 if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) 181 if (0 != GNUNET_OS_process_kill (proc, SIGTERM))