コード例 #1
0
ファイル: dbTest.c プロジェクト: yiwenshao/Chiredis
static void* __thread_worker(void *thread_input) {

    int my_tid = ((thread_struct*)thread_input)->tid;
    //connect
    functionStruct* localFunction = ((thread_struct*)thread_input)->function;
    void *thread_prepare_out = localFunction->prepare(thread_input,localFunction->prepare_in);   
    printf("this tid = %d\n",my_tid); 

    benchmarkConfig *bc = ((thread_struct*)thread_input)->bc;
    //use the benchmark; 
    benchmarkInfo *benchmark = initBenchmark(bc->totalCount);
    benchmark = loadData(benchmark);
    kvPair *tempPair;
    char *key,*value;
    long long total_start = s_time();

    int i;
    for(i=0;i<bc->totalCount;i++) {
        tempPair = getKvPair(benchmark);
        long long start = us_time();
        localFunction->operation_out = localFunction->operation((void*)tempPair,thread_input,thread_prepare_out);
        long long end = us_time();
        addDuration(benchmark,end-start);
    }

    long long total_end = s_time();
    localFunction->end_out = localFunction->end(thread_input,thread_prepare_out);
    char temp[11] = "pip";
    sprintf(temp+3,"%d",my_tid);
    //after benchmark
    setFileName(benchmark,temp);
    flushResults(benchmark);
    
    return (void*)0;
}
コード例 #2
0
ファイル: packet.c プロジェクト: ItsAGeekThing/Xtheme
void irc_handle_connect(connection_t *cptr)
{
	/* add our server */
	{
		cptr->flags = CF_UPLINK;
		cptr->recvq_handler = irc_recvq_handler;
		connection_setselect_read(cptr, recvq_put);
		slog(LG_INFO, "irc_handle_connect(): connection to uplink established");
		me.connected = true;
		/* no SERVER message received */
		me.recvsvr = false;


		server_login();

#ifdef HAVE_GETTIMEOFDAY
		/* start our burst timer */
		s_time(&burstime);
#endif

		/* done bursting by this time... */
		ping_sts();

		/* ping our uplink every 5 minutes */
		if (ping_uplink_timer != NULL)
			mowgli_timer_destroy(base_eventloop, ping_uplink_timer);

		ping_uplink_timer = mowgli_timer_add(base_eventloop, "ping_uplink", ping_uplink, NULL, 300);

		me.uplinkpong = time(NULL);
	}
}
コード例 #3
0
ファイル: prompts.c プロジェクト: rforge/muste
void pvmaika(char aika[])
        {
        time_t ltime;

        time(&ltime);
        strcpy(aika,s_time(&ltime)); aika[24]=EOS;
        }
コード例 #4
0
ファイル: display_l.c プロジェクト: v3t3a/42_projects
static void	disp_all(char *file, t_stat *buf, t_max *max, char *option)
{
	disp_permit(buf->st_mode);
	disp_xattr(file);
	disp_link(buf, max->max_lnk);
	if (!(IS_G))
		disp_owner(owner_name(buf->st_uid), max->max_user);
	if (!(IS_O))
		disp_group(group_name(buf->st_gid), max->max_group);
	if (IS_O && IS_G)
		write(1, "  ", 2);
	disp_size(buf, max->max_size, max->is_b_c_file);
	ft_putstr(s_time(buf));
	write(1, " ", 1);
	(is_lnk(file)) ? disp_lnk_name(file) : 0;
	if (!(is_lnk(file)))
		ft_putstr_name(file);
	if (IS_P && is_file_or_dir(file) == 2)
		write(1, "/", 1);
	if (!(is_lnk(file)))
		write(1, "\n", 1);
}
コード例 #5
0
void parsecommand(char* s){
	int clength = 0;
	int error = 0;
	int hasParameter = 0;
	getCommand(s);
	clength = strlen(shellbuff.command);
	if(shellbuff.buffer[clength]==' '){
		hasParameter = 1;
		getParameter(shellbuff.buffer, clength);
	}
	// Execute the requested command 
	if(!strcmp(shellbuff.command,"test")){
		error = s_test(hasParameter, shellbuff.parameter);
	}
	if(!strcmp(shellbuff.command,"help")){
		error = s_help(hasParameter, shellbuff.parameter);
	}
	else if(!strcmp(shellbuff.command, "reboot")){
		error = s_reboot(hasParameter, shellbuff.parameter); 
	}
	else if(!strcmp(shellbuff.command,"clear")){
		error = s_clear(hasParameter, shellbuff.parameter);
	}
	else if(!strcmp(shellbuff.command,"about")){
		error = s_about(hasParameter, shellbuff.parameter);
	}
	else if(!strcmp(shellbuff.command,"time")){
		error = s_time(hasParameter, shellbuff.parameter);
	}
	else if(!strcmp(shellbuff.command,"bkg")){
		error = s_bkg(hasParameter, shellbuff.parameter);
	}
	else if(!strcmp(shellbuff.command,"ssavercolor")){
		error = s_ssavercolor(hasParameter, shellbuff.parameter);
	}
	else if(!strcmp(shellbuff.command,"ssavertime")){
		error = s_ssavertime(hasParameter, shellbuff.parameter);
	}
	else if(!strcmp(shellbuff.command,"timestyle")){
		error = s_timestyle(hasParameter, shellbuff.parameter);
	}
	else {
		printerror("COMMAND NOT FOUND\n");
	}
	// Print error messages if needed
	switch(error){
		case 1:
			printwarning("Too many arguments.\n");
			break;
		case 2:
			printwarning("Too few arguments.\n");
			break;
		case 3:
			printwarning("Invalid argument.\n");
			break;
		case 4:
			printwarning("This command doesn't receive parameters.\n");
			break;
		default:
			break;
	}
	return;
}