Exemplo n.º 1
0
int main(int argc, char **argv)
{
	parse_options(&config, argc, argv);
	debug = config.debug;
	benchmark(&config);

	return 0;
}
Exemplo n.º 2
0
int main(int argc, char *argv[])
{
	SSL_CTX *ctx;
	const SSL_METHOD *method = SSLv3_client_method();
	int client_fd;
	char *host;
	char *portnum;
	int bench_send = 0;
	int bench_recv = 0;
	int i;
	enum cipher_choice cipher_choice = CIPHER_ALL;

	if (argc < 3) {
		printf("Usage: %s <host_ip> <portnum> [opts]\n", argv[0]);
		exit(-1);
	}

	host = argv[1];
	portnum = argv[2];

	lib_init();

	for (i = 3; i < argc; i++) {
		if (strcmp("tls-1.2", argv[i]) == 0) {
			method = TLSv1_2_client_method();
		} else if (strcmp("tls-1.1", argv[i]) == 0) {
			method = TLSv1_1_client_method();
		} else if (strcmp("tls-1.0", argv[i]) == 0) {
			method = TLSv1_client_method();
		} else if (strcmp("ssl-3.0", argv[i]) == 0) {
			method = SSLv3_client_method();
		} else if (strcmp("bench-send", argv[i]) == 0) {
			bench_send = atoi(argv[++i]);
		} else if (strcmp("bench-recv", argv[i]) == 0) {
			bench_recv = atoi(argv[++i]);
		} else {
			printf("warning: unknown option: \"%s\"\n", argv[i]);
		}
	}

	ctx = client_init(method, cipher_choice);

	client_fd = connect_socket(host, atoi(portnum));

	printf("[status] connected. handshaking\n");

	SSL *ssl;
	ssl = SSL_new(ctx);
	SSL_set_fd(ssl, client_fd);

	if (bench_send > 0 || bench_recv > 0)
		benchmark(ssl, bench_send, bench_recv);
	else
		process(ssl);
	close(client_fd);
	SSL_CTX_free(ctx);
	return 0;
}
Exemplo n.º 3
0
int
main(int argc, char* argv[])
{
	namespace po = boost::program_options;

	try {

		po::options_description desc = commonOptions();
		desc.add_options()
			("neurons,n", po::value<unsigned>()->default_value(1000), "number of neurons")
			("synapses,m", po::value<unsigned>()->default_value(1000), "number of synapses per neuron")
			("dmax,d", po::value<unsigned>()->default_value(1), "maximum excitatory delay,  where delays are uniform in range [1, dmax]")
		;

		po::variables_map vm = processOptions(argc, argv, desc);

		unsigned ncount = vm["neurons"].as<unsigned>();
		unsigned scount = vm["synapses"].as<unsigned>();
		unsigned dmax = vm["dmax"].as<unsigned>();
		unsigned duration = vm["duration"].as<unsigned>();
		unsigned stdp = vm["stdp-period"].as<unsigned>();
		unsigned verbose = vm["verbose"].as<unsigned>();
		bool runBenchmark = vm.count("benchmark") != 0;

		std::ofstream file;
		std::string filename;

		if(vm.count("output-file")) {
			filename = vm["output-file"].as<std::string>();
			file.open(filename.c_str()); // closes on destructor
		}

		std::ostream& out = filename.empty() ? std::cout : file;

		LOG(verbose, "Constructing network");
		boost::scoped_ptr<nemo::Network> net(nemo::random::construct(ncount, scount, dmax, stdp != 0));
		LOG(verbose, "Creating configuration");
		nemo::Configuration conf = configuration(vm);
		LOG(verbose, "Simulation will run on %s", conf.backendDescription());
		LOG(verbose, "Creating simulation");
		boost::scoped_ptr<nemo::Simulation> sim(nemo::simulation(*net, conf));
		LOG(verbose, "Running simulation");
		if(runBenchmark) {
			benchmark(sim.get(), ncount, scount, vm);
		} else {
			simulate(sim.get(), duration, stdp, out);
		}
		LOG(verbose, "Simulation complete");
		return 0;
	} catch(std::exception& e) {
		std::cerr << e.what() << std::endl;
		return -1;
	} catch(...) {
		std::cerr << "random: An unknown error occurred\n";
		return -1;
	}

}
Exemplo n.º 4
0
Arquivo: tests.c Projeto: fohr/librope
int main(int argc, const char * argv[]) {
  test_all();
  
  if (argc > 1 && strcmp(argv[1], "-b") == 0) {
    benchmark();
  }
  
  return 0;
}
Exemplo n.º 5
0
main() {
    connectDevice();
    printf("Connected\n");
    
    benchmark();

    disconnectDevice();
    printf("Disconnected\n");
}
Exemplo n.º 6
0
int
main(int argc, char **argv)
{
  int num_games_per_point = 10;
  if (argc > 1)
    num_games_per_point = atoi(argv[1]);
  benchmark(num_games_per_point);
  return EXIT_SUCCESS;
}
Exemplo n.º 7
0
// %Tag(MAIN)%
int main(int argc, char** argv)
{
  ros::init(argc, argv, "comparator_node");
  ros::NodeHandle nh;
  ros::NodeHandle nh_private("~");
  rgbd_benchmark::Comparator benchmark(nh, nh_private);

  ros::spin();
}
Exemplo n.º 8
0
int main(int argc, char **argv)
{
	Timing::getInstance();

	//set stuff up
	if (!setup()) {
		std::cout << "Setup failed!" << std::endl;
		return -1;
	}

	std::string cmd(GetCommandLine());
	if (cmd.find("-i") != std::string::npos) {
		//free running test. print keys
		std::cout << "Possible keys are:" << std::endl;
		std::cout << "0-3: Select test (none/glReadPixels/glGetTexImage/PBOs)" << std::endl;
		std::cout << "-/+: Change test mode (none/GL_BGRA/GL_RGBA)" << std::endl;
		std::cout << "f: Show frame time" << std::endl;
		std::cout << "ESC: Quit" << std::endl;

		//start loop
		unsigned int startTicks = Timing::getTimeMsui();
		do {
			interactive();

            //show frames/sec in title
            frames++;
            unsigned long endTicks = Timing::getTimeMsui();
            unsigned long tickDelta = endTicks - startTicks;
            if (tickDelta >= 3000) {
                std::cout.setf(std::ios::fixed, std::ios::floatfield);
                std::cout.precision(2);
                std::cout << "frame time " << (float)tickDelta / frames << " ms" << std::endl;
                startTicks = endTicks;
                frames = 0;
            }

            //process windows messages
            MSG msg;
            if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) > 0) {
                if (WM_QUIT == msg.message) {
                    break;
                }
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }
            //Sleep(1);
        } while (!GetAsyncKeyState(VK_ESCAPE));
    }
	else {
		//run benchmark
		benchmark();
	}
    //SendMessage(glWinHWND, WM_CLOSE, 0, 0);
    //ExitProcess(0);
	return 0;
}
Exemplo n.º 9
0
int
main(int ac, char **av)
{
	CLIENT *cl;
	struct	timeval tv;
	char	*server;
	char	buf[256];
	int	i;

	if (ac != 2 && ac != 3) {
		fprintf(stderr, "Usage: %s -s\n OR %s serverhost [proto]\n OR %s -serverhost\n",
		    av[0], av[0], av[0]);
		exit(1);
	}

	if (!strcmp(av[1], "-s")) {
		if (fork() == 0) {
			server_main();
		}
		exit(0);
	}

	server = av[1][0] == '-' ? &av[1][1] : av[1];

	if (av[1][0] == '-') {
		cl = clnt_create(server, XACT_PROG, XACT_VERS, proto[1]);
		if (!cl) {
			clnt_pcreateerror(server);
			exit(1);
		}
		clnt_call(cl, RPC_EXIT, (xdrproc_t)xdr_void, 0, 
			  (xdrproc_t)xdr_void, 0, TIMEOUT);
		exit(0);
	}

	if (ac == 3) {
		benchmark(server, av[2]);
	} else {
		benchmark(server, proto[0]);
		benchmark(server, proto[1]);
	}
	exit(0);
}
Exemplo n.º 10
0
int main() {
    long size;
    int stride;

    for (size=SIZE_MIN; size <= SIZE_MAX; size=size*2) {
	for (stride=STRIDE_MIN; stride <= STRIDE_MAX; stride=stride*2) {
	    benchmark(size, stride);
	}
    }
}
Exemplo n.º 11
0
int main(int argc, char **argv)
{
    //allocate memory 16-byte aligned
    short *scalar_input = (short*) memalign(16, IDCT_SIZE*IDCT_SIZE*sizeof(short));
    short *scalar_output = (short *) memalign(16, IDCT_SIZE*IDCT_SIZE*sizeof(short));

    short *simd_input = (short*) memalign(16, IDCT_SIZE*IDCT_SIZE*sizeof(short));
    short *simd_output = (short *) memalign(16, IDCT_SIZE*IDCT_SIZE*sizeof(short));

    //initialize input
    printf("input array:\n");
    for(int j=0;j<IDCT_SIZE;j++){
        for(int i=0;i<IDCT_SIZE;i++){
            short value = rand()%2 ? (rand()%32768) : -(rand()%32768) ;
            scalar_input[j*IDCT_SIZE+i] = value;
            simd_input  [j*IDCT_SIZE+i] = value;
	    printf("%d\t", value);
        }
        printf("\n");
    }

    idct16_scalar(scalar_input, scalar_output);
    idct16_simd  (simd_input  , simd_output);

    //check for correctness
    compare_results (scalar_output, simd_output, "scalar and simd");

    printf("output array:\n");
    for(int j=0;j<IDCT_SIZE;j++){
        for(int i=0;i<IDCT_SIZE;i++){
	    printf("%d\t", scalar_output[j*IDCT_SIZE+i]);
        }
        printf("\n");
    }

    //Measure the performance of each kernel
    benchmark (idct16_scalar, scalar_input, scalar_output, "scalar");
    benchmark (idct16_simd, simd_input, simd_output, "simd");

    //cleanup
    free(scalar_input);    free(scalar_output);
    free(simd_input); free(simd_output);
}
Exemplo n.º 12
0
int main()
{
	of.open("results.txt");
	benchmark();
	std::cout << "Done." << std::endl;
	getchar(); // Wait for keypress on exit so we can read console output
	of.close();

	return 0;
}
Exemplo n.º 13
0
int main(int argc, char * argv[]) {
		
	srand_file();
	Parameters p;
	if(set_parameters(argc, argv, p)==false) {
		if (argc>1)
			cerr<<"Please, look at ReadMe.txt..."<<endl;		
		return -1;
	}
	
	erase_file_if_exists("network.dat");
	erase_file_if_exists("community.dat");
	erase_file_if_exists("statistics.dat");

    int sy0= system("rm network_*");
    sy0= system("rm community_*");
    sy0= system("rm network_layer_*");

        
    int num_of_original_graphs=p.num_of_original_graphs;
    int num_of_layers=p.num_of_layers;    
    int layer_index=0;
    
    cout<<"No. of original graphs: "<<num_of_original_graphs<<" No. of layers per graph: "<<num_of_layers<<endl;
    
    int max_assignment=0;
    ofstream comout("level_node_cluster.clu");
    ofstream multiplexout("level_node_node_weight.edges");
    multiplexout<<"*Intra"<<endl;
    
    
    for(int ori=0; ori<num_of_original_graphs; ori++) {
        
        // generating and printing graph
        benchmark(p.excess, p.defect, p.num_nodes, p.average_k, p.max_degree, p.tau, p.tau2, \
                  p.mixing_parameter, p.overlapping_nodes, p.overlap_membership, \
                  p.nmin, p.nmax, p.fixed_range, p.clustering_coeff);	
        
        char buffer[1000];
        sprintf(buffer, "mv network.dat network_%d", ori);
        int sy=system(buffer);
        sprintf(buffer, "mv community.dat community_%d", ori);
        sy=system(buffer);
        system("rm statistics.dat");
        
        // creating layers
        max_assignment= create_layers(layer_index, num_of_layers, ori, comout, max_assignment, multiplexout);
    
    }
    comout.close();
    multiplexout.close();
    
	return 0;
	
}
Exemplo n.º 14
0
int main()
{
    size_t N = 1000;
    for (size_t i = 0; i < 3; ++i)
    {
        benchmark(N);
        N *= 100;
    }

    return 0;
}
Exemplo n.º 15
0
int main(void) {
	gfxInit();
	
	benchmark();
    
	while(TRUE) {
		gfxSleepMilliseconds(500);
	}

	return 0;
}
void benchmark_driver(void)
{
    struct command_def command;
     
    while(1)
    {
        //get command       
        // start benchmark
        benchmark(command);   
    }
}
Exemplo n.º 17
0
/*!
 * \brief Parses a command
 * \param cmd Command string to be parsed
 * \param handled Sets this variable to TRUE if command was handled
 * \param io I/O stream to be used for input/output
 * \return Error code, ERR_OK if everything was fine
 */
static uint8_t ParseCommand(const unsigned char *cmd, bool *handled, const CLS1_StdIOType *io) {
  /* handling our own commands */
  if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0) {
    CLS1_SendHelpStr((const unsigned char*)"run benchmark", (const unsigned char*)"Run FatFS benchmark\r\n", io->stdOut);
    *handled = TRUE;
  } else if (UTIL1_strcmp((char*)cmd, "run benchmark")==0) {
    benchmark(io);
    *handled = TRUE;
  }
  return ERR_OK;
}
Exemplo n.º 18
0
int main(int argc, char **argv)
{
    const int n = 7777;
    
    // initialize the array with random values
	srand48(time(NULL));
	int a[n] __attribute__((aligned(16)));
	for (int i = 0; i < n; i++)
	{
		a[i] = lrand48();
	}
    
    // benchmark series of codes
	benchmark(n, a, sum_naive, "naive");
	benchmark(n, a, sum_unrolled, "unrolled");
	benchmark(n, a, sum_vectorized, "vectorized");
	benchmark(n, a, sum_vectorized_unrolled, "vectorized unrolled");

    return 0;
}
Exemplo n.º 19
0
int main(int argc, char* argv[])
{
	int debug_flag;
	int n;
	int t;

	if (parse_args(argc, argv, &debug_flag, "input size", &n, "threads", &t, NULL, NULL, NULL, NULL) != 0)
	{
		fail("Error while parsing args.");
	}

	if ((n < 1) || (t < 1))
	{
		fail("Bad input");
	}

	omp_set_num_threads(t);

	ATYPE* data = geninput(n);
	int plus_ops = 0;
	int acc_ops = 0;

	if (debug_flag) print_array("input", data, n);

	double dtime;
	benchmark(data, n, &plus_ops, &acc_ops, &dtime);

	if (debug_flag)
	{
		/* ========== OUTPUT =========== */

		print_array("output", data, n);
		print_perf_debug(n, t, plus_ops, acc_ops, dtime);

		ATYPE* ref = reference(n);

		if (array_equal(data, ref, n))
		{
			printf("SUCCESS\n");
		}
		else
		{
			printf("EPIC FAILURE\n");
		}

		free(ref);
	}
	else
	{
		print_perf(n, t, plus_ops, acc_ops, dtime);
	}

	free(data);
}
Exemplo n.º 20
0
int
main(int argc, char *argv[])
{
    enum ofputil_protocol usable_protocols;
    struct ofputil_flow_mod *fms = NULL;
    static struct classifier cls;
    struct cls_rule *rules;
    size_t n_fms, i;
    char *error;

    set_program_name(argv[0]);
    vlog_set_levels(NULL, VLF_ANY_FACILITY, VLL_DBG);


    if (argc < 2) {
        usage();
    }

    if (!strncmp(argv[1], "hsa", 3)) {
        VLOG_DBG("Enabling HSA");
        cls.enable_hsa = true;
    }

    VLOG_DBG("using file: %s", argv[2]);
    error = parse_ofp_flow_mod_file(argv[2], OFPFC_ADD, &fms, &n_fms,
                                    &usable_protocols);
    if (error) {
        ovs_fatal(0, "%s", error);
    }

    classifier_init(&cls, flow_segment_u32s);

    fat_rwlock_wrlock(&cls.rwlock);
    rules = xmalloc(n_fms * sizeof *rules);
    for (i = 0; i < n_fms; i++) {
        struct cls_rule *rule = &rules[i];
        struct cls_rule *displaced_rule;

        cls_rule_init(rule, &fms[i].match, fms[i].priority);
        displaced_rule = classifier_replace(&cls, rule);
        if (displaced_rule) {
            cls_rule_destroy(displaced_rule);
            VLOG_WARN("TODO");
        }
    }
    fat_rwlock_unlock(&cls.rwlock);

    benchmark(&cls);

    free(rules);
    free(fms);
    return 0;
}
Exemplo n.º 21
0
	BenchmarkCompareResults benchmark_compare(StringRef description, uint32 iterations, ArrayRef<Function<void()>> functions, ArrayRef<StringRef> descriptions) {
		BenchmarkCompareResults results;
		results.results.reserve(functions.size());
		results.description = description;
		
		for (size_t i = 0; i < functions.size(); ++i) {
			StringRef d = i >= descriptions.size() ? "<unknown>" : descriptions[i];
			BenchmarkResults r = benchmark(d, iterations, functions[i]);
			results.results.push_back(move(r));
		}
		
		return move(results);
	}
Exemplo n.º 22
0
int main( int argc, char **argv ) {
    if (argc != 3) {
        printf("Usage: transpose <n> <blocksize>\nExiting.\n");
        exit(1);
    }

    int n = atoi(argv[1]);
    int blocksize = atoi(argv[2]);

    /* allocate an n*n block of integers for the matrices */
    int *A = (int*)malloc( n*n*sizeof(int) );
    int *B = (int*)malloc( n*n*sizeof(int) );

    /* run tests */
    benchmark(A, B, n, blocksize, transpose_naive, "naive transpose");
    benchmark(A, B, n, blocksize, transpose_blocking, "transpose with blocking");

    /* release resources */
    free( A );
    free( B );
    return 0;
}
Exemplo n.º 23
0
Arquivo: lms.c Projeto: ks07/beebs
int main()
{
    int n;

    initialise_board();
    start_trigger();

    for(n = 0; n < SCALE_FACTOR; ++n)
    {
        benchmark();
    }
    stop_trigger();
    return 0;
}
Exemplo n.º 24
0
int
main (void)
{
  int i;

  initialise_board ();
  start_trigger ();

  for (i = 0; i < REPEAT_FACTOR; i++)
    benchmark ();

  stop_trigger ();
  return 0;
}
Exemplo n.º 25
0
int main(int argc, char const *argv[])
{
	double runtime[4][3][10]; // [type][{10,11,12}][test{1~10}]
	FILE *result;
	fopen_s(&result, "benchmark.out", "w");
	
	
	for(int i = 0; i<4; i++)
		for(int j = 0; j<3; j++)
		for (int k = 0; k < 10; k++)
		{
			runtime[i][j][k] = benchmark(i, j + 10);
			printf("type %d, size %d, test %d\n", i, j + 10, k);
		}
				
			
	for(int j = 0; j<3; j++)
	{
		fprintf(result, "n = %d\n", j + 10);
		for(int i = 0; i<4; i++)
		{
			switch (i)
			{
				case 0:
					fprintf(result, "dict     ");
					break;
				case 1:
					fprintf(result, "dict_new ");
					break;
				case 2:
					fprintf(result, "adj      ");
					break;
				case 3:
					fprintf(result, "heap     ");
					break;
				default:
					break;
			}
			
			for(int k = 0; k<10; k++)
				fprintf(result, "%8.1lf ", runtime[i][j][k]);
			fprintf(result, "\n");
		}
			
		fprintf(result, "\n\n");
	}
	
	fclose(result);
	return 0;
}
Exemplo n.º 26
0
int main( int argc, char* argv[] )
{
  // BENCHMARK #1:  Try to maximize store-data forwarding.

  setStats(1);
  benchmark();
  setStats(0);

  // Check the results
 

  return 0; // You'll probably want to call your verify function here.
            // Return 0 for success, anything else for failure.
}
Exemplo n.º 27
0
int main()
{

//	vector<vector<pair<int,int> > > r;
//	r=genPAorders(6);

//	PMStruc pedmd(5);
//	benchmark();


    benchmark();

    return 0;
}
Exemplo n.º 28
0
int
main (void)
{
  int i;

  initialise_trigger ();
  start_trigger ();

  for (i = 0; i < SCALE_FACTOR; i++)
    benchmark ();

  stop_trigger ();
  return 0;
}
void LatencyWorkloadBenchmark::handleBenchmarkSessionReady(BenchmarkSession* session) {
	boost::unique_lock<boost::mutex> lock(handleSessionReadyMutex);
	sessionsReadyToBenchmark++;
	if (sessionsReadyToBenchmark == sessionsToActivate.size()) {
		std::cout << "done." << std::endl;
		std::cout << "All sessions ready. Starting benchmark now!" << std::endl;
		benchmark();
	} else {
		if (nextActivateSession != sessionsToActivate.end()) {
			(*nextActivateSession)->start();
			++nextActivateSession;
		}
	}
}
Exemplo n.º 30
0
void main(){
    benchmark(paint4,rect,0);
    benchmark(paint8,rect,0);
    benchmark(paintline,rect,0);

    benchmark(paint4,gong,0);
    benchmark(paint8,gong,0);
    benchmark(paintline,gong,0);
}