Esempio n. 1
0
int main(int argc, char *argv[]) {
    int n = 100;
    int k = 100;
    double *x;
    struct timeval tv1, tv2;
    long counter;
    if (argc > 1)
        n = atoi(argv[1]);
    if (argc > 2)
        k = atoi(argv[2]);
    x = init(n);
    gettimeofday(&tv1, NULL);
    counter = count_if(x, n, k);
    gettimeofday(&tv2, NULL);
    printf("if condition:         %.6lf (%ld)\n",
            tv2.tv_sec - tv1.tv_sec + 1.0e-6*(tv2.tv_usec - tv1.tv_usec),
            counter);
    gettimeofday(&tv1, NULL);
    counter = count_cond_expr(x, n, k);
    gettimeofday(&tv2, NULL);
    printf("condition expression: %.6lf (%ld)\n",
            tv2.tv_sec - tv1.tv_sec + 1.0e-6*(tv2.tv_usec - tv1.tv_usec),
            counter);
    free(x);
    x = init_cont(n, counter/k);
    gettimeofday(&tv1, NULL);
    counter = count_if(x, n, k);
    gettimeofday(&tv2, NULL);
    printf("if condition:         %.6lf (%ld)\n",
            tv2.tv_sec - tv1.tv_sec + 1.0e-6*(tv2.tv_usec - tv1.tv_usec),
            counter);
    gettimeofday(&tv1, NULL);
    counter = count_cond_expr(x, n, k);
    gettimeofday(&tv2, NULL);
    printf("condition expression: %.6lf (%ld)\n",
            tv2.tv_sec - tv1.tv_sec + 1.0e-6*(tv2.tv_usec - tv1.tv_usec),
            counter);
    free(x);
    return EXIT_SUCCESS;
} 
/**
 * Initial ego collection function.
 *
 * @param cls NULL
 * @param ego ego
 * @param ctx context
 * @param identifier ego name
 */
static void
list_ego (void *cls,
          struct GNUNET_IDENTITY_Ego *ego,
          void **ctx,
          const char *identifier)
{
  struct EgoEntry *new_entry;
  if ((NULL == ego) && (STATE_INIT == state))
  {
    state = STATE_POST_INIT;
    init_cont ();
    return;
  }
  if (STATE_INIT == state) {
    new_entry = GNUNET_malloc (sizeof (struct EgoEntry));
    new_entry->ego = ego;
    new_entry->attr_map = GNUNET_CONTAINER_multihashmap_create (5,
                                                                GNUNET_NO);
    new_entry->attributes_dirty = GNUNET_YES;
    GNUNET_CONTAINER_DLL_insert_tail(ego_head, ego_tail, new_entry);
  }
}
Esempio n. 3
0
  Nuca::Nuca(
      TechnologyParameter::DeviceType *dt
      ):deviceType(dt)
{
  init_cont();
}
Esempio n. 4
0
  Nuca::Nuca(
      TechnologyParameter::DeviceType *dt = &(g_tp.peri_global)
      ):deviceType(dt)
{
  init_cont();
}