int
main (int argc, char *const *argv)
{
  unsigned int errorCount = 0;
  (void)argc;   /* Unused. Silent compiler warning. */

  if (NULL == argv || 0 == argv[0])
    return 99;
  oneone = has_in_name (argv[0], "11");
  if (0 != curl_global_init (CURL_GLOBAL_WIN32))
    return 2;
  if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_THREADS))
    {
      start_time = now();
      errorCount += testInternalPost ();
      fprintf (stderr,
	       oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential POSTs (http/1.0) %f/s\n",
	       "internal select",
	       (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0));
      GAUGER ("internal select",
	      oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs (http/1.0)",
	      (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0),
	      "requests/s");
      start_time = now();
      errorCount += testMultithreadedPost ();
      fprintf (stderr,
	       oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential POSTs (http/1.0) %f/s\n",
	       "multithreaded post",
	       (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0));
      GAUGER ("Multithreaded select",
	      oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs (http/1.0)",
	      (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0),
	      "requests/s");
      start_time = now();
      errorCount += testMultithreadedPoolPost ();
      fprintf (stderr,
	       oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential POSTs (http/1.0) %f/s\n",
	       "thread with pool",
	       (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0));
      GAUGER ("thread with pool",
	      oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs (http/1.0)",
	      (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0),
	      "requests/s");
    }
  start_time = now();
  errorCount += testExternalPost ();
  fprintf (stderr,
	   oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential POSTs (http/1.0) %f/s\n",
	   "external select",
	   (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0));
  GAUGER ("external select",
	  oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs (http/1.0)",
	  (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0),
	  "requests/s");
  if (errorCount != 0)
    fprintf (stderr, "Error (code: %u)\n", errorCount);
  curl_global_cleanup ();
  return errorCount != 0;       /* 0 == pass */
}
int
main (int argc, char *const *argv)
{
  unsigned int errorCount = 0;

  oneone = (NULL != strrchr (argv[0], (int) '/')) ?
    (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0;
  if (0 != curl_global_init (CURL_GLOBAL_WIN32))
    return 2;
  start_time = now();
  errorCount += testInternalPost ();
  fprintf (stderr,
	   oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential POSTs (http/1.0) %f/s\n",
	   "internal select",
	   (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0));
  GAUGER ("internal select",
	  oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs (http/1.0)",
	  (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0),
	  "requests/s");
  start_time = now();
  errorCount += testMultithreadedPost ();
  fprintf (stderr,
	   oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential POSTs (http/1.0) %f/s\n",
	   "multithreaded post",
	   (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0));
  GAUGER ("Multithreaded select",
	  oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs (http/1.0)",
	  (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0),
	  "requests/s");
  start_time = now();
  errorCount += testMultithreadedPoolPost ();
  fprintf (stderr,
	   oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential POSTs (http/1.0) %f/s\n",
	   "thread with pool",
	   (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0));
  GAUGER ("thread with pool",
	  oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs (http/1.0)",
	  (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0),
	  "requests/s");
  start_time = now();
  errorCount += testExternalPost ();
  fprintf (stderr,
	   oneone ? "%s: Sequential POSTs (http/1.1) %f/s\n" : "%s: Sequential POSTs (http/1.0) %f/s\n",
	   "external select",
	   (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0));
  GAUGER ("external select",
	  oneone ? "Sequential POSTs (http/1.1)" : "Sequential POSTs (http/1.0)",
	  (double) 1000 * LOOPCOUNT / (now() - start_time + 1.0),
	  "requests/s");
  if (errorCount != 0)
    fprintf (stderr, "Error (code: %u)\n", errorCount);
  curl_global_cleanup ();
  return errorCount != 0;       /* 0 == pass */
}
Exemple #3
0
int
main (int argc, char *const *argv)
{
  unsigned int errorCount = 0;

  oneone = NULL != strstr (argv[0], "11");
  if (0 != curl_global_init (CURL_GLOBAL_WIN32))
    return 2;
  errorCount += testInternalPost ();
  errorCount += testMultithreadedPost ();
  errorCount += testMultithreadedPoolPost ();
  errorCount += testExternalPost ();
  if (errorCount != 0)
    fprintf (stderr, "Error (code: %u)\n", errorCount);
  curl_global_cleanup ();
  return errorCount != 0;       /* 0 == pass */
}
Exemple #4
0
int
main (int argc, char *const *argv)
{
  unsigned int errorCount = 0;

#ifdef HAVE_GCRYPT_H
  gcry_control (GCRYCTL_ENABLE_QUICK_RANDOM, 0);
#ifdef GCRYCTL_INITIALIZATION_FINISHED
  gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0);
#endif
#endif
  oneone = (NULL != strrchr (argv[0], (int) '/')) ?
    (NULL != strstr (strrchr (argv[0], (int) '/'), "11")) : 0;
  if (0 != curl_global_init (CURL_GLOBAL_WIN32))
    return 2;
  errorCount += testInternalPost ();
  errorCount += testMultithreadedPost ();
  errorCount += testMultithreadedPoolPost ();
  errorCount += testExternalPost ();
  if (errorCount != 0)
    fprintf (stderr, "Error (code: %u)\n", errorCount);
  curl_global_cleanup ();
  return errorCount != 0;       /* 0 == pass */
}