Example #1
0
int main() {
	time_stats_t ts;
	int16_t x[16];
	int16_t y[16];
	int16_t z[16];
	int N = 16;
	int i;
	
	time_t t;
	srand((unsigned) time(&t));
	for(i=0; i<16; i++){
		x[i] = rand()%1000;
		y[i] = rand()%1000;
		z[i] = 0;
		printf("%d ",x[i]);
	}
	printf("\nThat was x, now y: \n");

		
	for(i=0; i<16; i++){
		printf("%d ",y[i]);
	}
	printf("\n");	
	reset_meas(&ts);
	start_meas(&ts);
	m16_vv(x, y, z, N);
	stop_meas(&ts);
	printf("z:\n");	
	for(i=0; i<16; i++){
		printf("%d ",z[i]);
	}
	printf("\nTimemeasure: %lld \n",ts.diff);	

	return 0;
}
Example #2
0
int main() {


	int16_t x[2048]; int16_t y[2048]; int16_t z[2048];
	int i,j;


	time_t t; 
	/* Intializes random number generator */
    srand((unsigned) time(&t));
	for( j = 0 ; j < 2048 ; j++ ){ 
		x[j] = rand()%1000;
		y[j] = rand()%1000; 
		z[j] = 0;
   	}

	printf("x = [ ");
	for( j = 0 ; j < 2048 ; j++ ){ 
		printf("%d, ", x[j]);
	
	}
	printf(" ] \n");
	printf("y = [ ");

	for( j = 0 ; j < 2048 ; j++ ){ 
		printf("%d, ", y[j]);	
	}
	printf("]\n");

	m16_vv(x,y,z,2048);
	printf("z = [ ");
	for (i=0;i<16; i++){
	printf("%d, ", z[i]);
    }

	printf(" ]\n");

	printf("should be ");
	
	printf(" = [ ");
	for (i=0;i<16; i++){
		printf("%d, ", (int)((x[i]*y[i])/pow(2,16)) *2  );	
	}
	printf(" ]\n");
	time_stats_t ts;
	reset_meas (&ts);
	start_meas (&ts);

	unsigned long long k;
	for(k=0;k< 4000000; k++){
		m16_vv(x,y,z,2048);

	}
	stop_meas (&ts);
	printf("difference:  %lld \n", ts.diff);

return 0;
}
Example #3
0
int main(int argc, char *argv[]){
    reset_meas(&ts);
    
    N = atoi(argv[1]);
    x = malloc(N*sizeof(int16_t));
    y = malloc(N*sizeof(int16_t));
    z = malloc(N*sizeof(int16_t));
    
    start_meas(&ts);
    
    for (j=0; j<1000; j++){
        operation(x,y,z,N);
    }
    stop_meas(&ts);
    printf("%llu\n", (ts.diff)/1000);
    return(0);
}
//-----------------------------------------------------------------------------
int
pdcp_netlink_init(
    void
)
//-----------------------------------------------------------------------------
{

    int                i;
    int                nb_inst_enb;
    int                nb_inst_ue;
    pthread_attr_t     attr;
    struct sched_param sched_param;

    reset_meas(&ip_pdcp_stats_tmp);
#if defined(USER_MODE) && defined(OAI_EMU)
    nb_inst_enb = oai_emulation.info.nb_enb_local;
    nb_inst_ue  = oai_emulation.info.nb_ue_local;
#else
    nb_inst_enb = 1;
    nb_inst_ue  = 1;
#endif

#if defined(LINK_ENB_PDCP_TO_GTPV1U)
    nb_inst_enb = 0;
    LOG_I(PDCP, "[NETLINK] Creating 0 queues for eNB Netlink -> PDCP communication\n");
#else
#warning " LG: When there will be handover in, there will problems because dim is based on local nums of ues"
    pdcp_netlink_queue_enb      = calloc(nb_inst_enb, sizeof(struct lfds611_queue_state*));
    pdcp_netlink_nb_element_enb = malloc(nb_inst_enb * sizeof(uint32_t));
    LOG_I(PDCP, "[NETLINK] Creating %d queues for eNB Netlink -> PDCP communication\n", nb_inst_enb);

    for (i = 0; i < nb_inst_enb; i++) {
        pdcp_netlink_nb_element_enb[i] = 0;

        if (lfds611_queue_new(&pdcp_netlink_queue_enb[i], PDCP_QUEUE_NB_ELEMENTS) < 0) {
            LOG_E(PDCP, "Failed to create new FIFO for eNB Netlink -> PDCP communcation instance %d\n", i);
            exit(EXIT_FAILURE);
        }
    }

#endif

    if (nb_inst_ue  > 0) {
        pdcp_netlink_queue_ue       = calloc(nb_inst_ue, sizeof(struct lfds611_queue_state*));
        pdcp_netlink_nb_element_ue  = malloc(nb_inst_ue * sizeof(uint32_t));

        LOG_I(PDCP, "[NETLINK] Creating %d queues for UE Netlink -> PDCP communication\n", nb_inst_ue);

        for (i = 0; i < nb_inst_ue; i++) {
            pdcp_netlink_nb_element_ue[i] = 0;

            if (lfds611_queue_new(&pdcp_netlink_queue_ue[i], PDCP_QUEUE_NB_ELEMENTS) < 0) {
                LOG_E(PDCP, "Failed to create new FIFO for UE Netlink -> PDCP communcation instance %d\n", i);
                exit(EXIT_FAILURE);
            }
        }
    }

    if ((nb_inst_ue + nb_inst_enb) > 0) {
        if (pthread_attr_init(&attr) != 0) {
            LOG_E(PDCP, "[NETLINK]Failed to initialize pthread attribute for Netlink -> PDCP communication (%d:%s)\n",
                  errno, strerror(errno));
            exit(EXIT_FAILURE);
        }

        sched_param.sched_priority = 10;

        pthread_attr_setschedpolicy(&attr, SCHED_RR);
        pthread_attr_setschedparam(&attr, &sched_param);

        /* Create one thread that fetchs packets from the netlink.
         * When the netlink fifo is full, packets are silently dropped, this behaviour
         * should be avoided if we want a reliable link.
         */
        if (pthread_create(&pdcp_netlink_thread, &attr, pdcp_netlink_thread_fct, NULL) != 0) {
            LOG_E(PDCP, "[NETLINK]Failed to create new thread for Netlink/PDCP communication (%d:%s)\n",
                  errno, strerror(errno));
            exit(EXIT_FAILURE);
        }

        pthread_setname_np( pdcp_netlink_thread, "PDCP netlink" );
    }

    return 0;
}