当前位置: 首页>>代码示例>>C++>>正文


C++ profile_start函数代码示例

本文整理汇总了C++中profile_start函数的典型用法代码示例。如果您正苦于以下问题:C++ profile_start函数的具体用法?C++ profile_start怎么用?C++ profile_start使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了profile_start函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: do_encode

static inline void do_encode(struct obs_encoder *encoder,
		struct encoder_frame *frame)
{
	profile_start(do_encode_name);
	if (!encoder->profile_encoder_encode_name)
		encoder->profile_encoder_encode_name =
			profile_store_name(obs_get_profiler_name_store(),
					"encode(%s)", encoder->context.name);

	struct encoder_packet pkt = {0};
	bool received = false;
	bool success;

	pkt.timebase_num = encoder->timebase_num;
	pkt.timebase_den = encoder->timebase_den;
	pkt.encoder = encoder;

	profile_start(encoder->profile_encoder_encode_name);
	success = encoder->info.encode(encoder->context.data, frame, &pkt,
			&received);
	profile_end(encoder->profile_encoder_encode_name);
	if (!success) {
		full_stop(encoder);
		blog(LOG_ERROR, "Error encoding with encoder '%s'",
				encoder->context.name);
		goto error;
	}

	if (received) {
		if (!encoder->first_received) {
			encoder->offset_usec = packet_dts_usec(&pkt);
			encoder->first_received = true;
		}

		/* we use system time here to ensure sync with other encoders,
		 * you do not want to use relative timestamps here */
		pkt.dts_usec = encoder->start_ts / 1000 +
			packet_dts_usec(&pkt) - encoder->offset_usec;
		pkt.sys_dts_usec = pkt.dts_usec;

		pthread_mutex_lock(&encoder->callbacks_mutex);

		for (size_t i = encoder->callbacks.num; i > 0; i--) {
			struct encoder_callback *cb;
			cb = encoder->callbacks.array+(i-1);
			send_packet(encoder, cb, &pkt);
		}

		pthread_mutex_unlock(&encoder->callbacks_mutex);
	}

error:
	profile_end(do_encode_name);
}
开发者ID:Incalex,项目名称:obs-studio,代码行数:54,代码来源:obs-encoder.c

示例2: obs_load_all_modules

void obs_load_all_modules(void)
{
	profile_start(obs_load_all_modules_name);
	obs_find_modules(load_all_callback, NULL);
#ifdef _WIN32
	profile_start(reset_win32_symbol_paths_name);
	reset_win32_symbol_paths();
	profile_end(reset_win32_symbol_paths_name);
#endif
	profile_end(obs_load_all_modules_name);
}
开发者ID:AhmedAbdulSalam5,项目名称:obs-studio,代码行数:11,代码来源:obs-module.c

示例3: os_set_thread_name

static void *video_thread(void *param)
{
	struct video_output *video = param;

	os_set_thread_name("video-io: video thread");

	const char *video_thread_name =
		profile_store_name(obs_get_profiler_name_store(),
				"video_thread(%s)", video->info.name);

	while (os_sem_wait(video->update_semaphore) == 0) {
		if (video->stop)
			break;

		profile_start(video_thread_name);
		while (!video->stop && !video_output_cur_frame(video)) {
			video->total_frames++;
		}

		video->total_frames++;
		profile_end(video_thread_name);

		profile_reenable_thread();
	}

	return NULL;
}
开发者ID:AhmedAbdulSalam5,项目名称:obs-studio,代码行数:27,代码来源:video-io.c

示例4: message

void Master::sendLearnts(int thread_no) {
        if (PAR_DEBUG) fprintf(stderr, "Sending learnts to %d\n", thread_no);

        vec<int> message(sizeof(Report)/sizeof(int),0);
        int num_learnts = 0;

        SClause *sc = (SClause*) &global_learnts[lhead[thread_no]];
        for ( ; (int*) sc != &global_learnts[global_learnts.size()]; sc = sc->getNext()) {
                if (sc->source == thread_no) continue;
                sc->pushInVec(message);
                num_learnts++;
        }
        lhead[thread_no] = global_learnts.size();

        Report& r = *((Report*) (int*) message);
        r.num_learnts = num_learnts;

        profile_start();

        MPI_Bsend((int*) message, message.size(), MPI_INT, thread_no+1, LEARNTS_TAG, MPI_COMM_WORLD);

        last_send_learnts[thread_no] = wallClockTime();

        profile_end("send learnts", message.size())
}
开发者ID:geoffchu,项目名称:chuffed,代码行数:25,代码来源:master.c

示例5: lpc_profile_start

static void lpc_profile_start(int state, ktime_t now)
{
	if (!is_state_lpc(state))
		return;

	profile_start(&lpc_info, 0, now);
}
开发者ID:MikeForeskin,项目名称:Vindicator-S6,代码行数:7,代码来源:cpuidle_profiler.c

示例6: exportBounds

void Slave::sendReport() {
        if (FULL_DEBUG) fprintf(stderr, "%d: Forming report\n", thread_no);
        static bool firstCall = true;
        if(firstCall){
            if(engine.decisionLevel() == 0 && so.shareBounds)
              exportBounds();
        }
        
        Report& r = *((Report*) (int*) report_message);
        r.status = status;

        if (FULL_DEBUG) fprintf(stderr, "%d: Sending report to master\n", thread_no);

        profile_start();

        MPI_Bsend((int*) report_message, report_message.size(), MPI_INT, 0, REPORT_TAG, MPI_COMM_WORLD);

        profile_end("send result", report_message.size());

        if (FULL_DEBUG) fprintf(stderr, "%d: Sent report to master\n", thread_no);

        report_message.clear();
        report_message.growTo(sizeof(Report)/sizeof(int),0);
        
        unitFound = false;
}
开发者ID:geoffchu,项目名称:chuffed,代码行数:26,代码来源:slave.c

示例7: lpm_profile_start

static void lpm_profile_start(int state, ktime_t now)
{
	if ((state & MAJOR_STATE) != LPM_STATE)
		return;

	profile_start(&lpm_info, get_lpm_substate(state), now);
}
开发者ID:MikeForeskin,项目名称:Vindicator-S6,代码行数:7,代码来源:cpuidle_profiler.c

示例8: receive_video

static void receive_video(void *param, struct video_data *frame)
{
    profile_start(receive_video_name);

    struct obs_encoder    *encoder  = param;
    struct encoder_frame  enc_frame;

    memset(&enc_frame, 0, sizeof(struct encoder_frame));

    for (size_t i = 0; i < MAX_AV_PLANES; i++) {
        enc_frame.data[i]     = frame->data[i];
        enc_frame.linesize[i] = frame->linesize[i];
    }

    if (!encoder->start_ts)
        encoder->start_ts = frame->timestamp;

    enc_frame.frames = 1;
    enc_frame.pts    = encoder->cur_pts;

    do_encode(encoder, &enc_frame);

    encoder->cur_pts += encoder->timebase_num;

    profile_end(receive_video_name);
}
开发者ID:skaramicke,项目名称:obs-studio,代码行数:26,代码来源:obs-encoder.c

示例9: digest_cost

/**
 * Calculate digest algorithm cost
 *
 * @v digest		Digest algorithm
 * @ret cost		Cost (in cycles per byte)
 */
unsigned long digest_cost ( struct digest_algorithm *digest ) {
	static uint8_t random[8192]; /* Too large for stack */
	uint8_t ctx[digest->ctxsize];
	uint8_t out[digest->digestsize];
	struct profiler profiler;
	unsigned long cost;
	unsigned int i;

	/* Fill buffer with pseudo-random data */
	srand ( 0x1234568 );
	for ( i = 0 ; i < sizeof ( random ) ; i++ )
		random[i] = rand();

	/* Profile digest calculation */
	memset ( &profiler, 0, sizeof ( profiler ) );
	for ( i = 0 ; i < PROFILE_COUNT ; i++ ) {
		profile_start ( &profiler );
		digest_init ( digest, ctx );
		digest_update ( digest, ctx, random, sizeof ( random ) );
		digest_final ( digest, ctx, out );
		profile_stop ( &profiler );
	}

	/* Round to nearest whole number of cycles per byte */
	cost = ( ( profile_mean ( &profiler ) + ( sizeof ( random ) / 2 ) ) /
		 sizeof ( random ) );

	return cost;
}
开发者ID:pipcet,项目名称:ipxe,代码行数:35,代码来源:digest_test.c

示例10: render_main_texture

static inline void render_main_texture(struct obs_core_video *video,
		int cur_texture)
{
	profile_start(render_main_texture_name);

	struct vec4 clear_color;
	vec4_set(&clear_color, 0.0f, 0.0f, 0.0f, 1.0f);

	gs_set_render_target(video->render_textures[cur_texture], NULL);
	gs_clear(GS_CLEAR_COLOR, &clear_color, 1.0f, 0);

	set_render_size(video->base_width, video->base_height);

	pthread_mutex_lock(&obs->data.draw_callbacks_mutex);

	for (size_t i = 0; i < obs->data.draw_callbacks.num; i++) {
		struct draw_callback *callback;
		callback = obs->data.draw_callbacks.array+i;

		callback->draw(callback->param,
				video->base_width, video->base_height);
	}

	pthread_mutex_unlock(&obs->data.draw_callbacks_mutex);

	obs_view_render(&obs->data.main_view);

	video->textures_rendered[cur_texture] = true;

	profile_end(render_main_texture_name);
}
开发者ID:benklett,项目名称:obs-studio,代码行数:31,代码来源:obs-video.c

示例11: profile_start

void Slave::splitJob() {
        vec<int> message;
        int num_splits;
        //fprintf(stderr, "%d: Split job called, assumptions.size()=%d, DL=%d!\n", thread_no, engine.assumptions.size(), engine.decisionLevel());
        profile_start();

        MPI_Recv(&num_splits, 1, MPI_INT, 0, STEAL_TAG, MPI_COMM_WORLD, &s);

        int max_splits = engine.decisionLevel() - engine.assumptions.size() - 1;
        if (num_splits > max_splits) num_splits = max_splits;
        if (num_splits < 0) num_splits = 0;
        
        if (FULL_DEBUG) fprintf(stderr, "%d: Splitting %d jobs\n", thread_no, num_splits);

        for (int i = 0; i < num_splits; i++) {
                engine.assumptions.push(toInt(sat.decLit(engine.assumptions.size()+1)));
                sat.incVarUse(engine.assumptions.last()/2);
        }
        assert(num_splits == 0 || engine.decisionLevel() > engine.assumptions.size());

        vec<Lit> ps;
        for (int i = 0; i < engine.assumptions.size(); i++) ps.push(toLit(engine.assumptions[i]));
        Clause *c = Clause_new(ps);
        
        sat.convertToSClause(*c);
        free(c);
        message.push(num_splits);
        sat.temp_sc->pushInVec(message);

        MPI_Bsend((int*) message, message.size(), MPI_INT, 0, SPLIT_TAG, MPI_COMM_WORLD);

        profile_end("send split job", message.size());

        if (FULL_DEBUG) fprintf(stderr, "%d: Sent %d split job to master\n", thread_no, message[0]);
}
开发者ID:geoffchu,项目名称:chuffed,代码行数:35,代码来源:slave.c

示例12: os_gettime_ns

static void *audio_thread(void *param)
{
	struct audio_output *audio = param;
	uint64_t buffer_time = audio->info.buffer_ms * 1000000;
	uint64_t prev_time = os_gettime_ns() - buffer_time;
	uint64_t audio_time;

	os_set_thread_name("audio-io: audio thread");

	const char *audio_thread_name =
		profile_store_name(obs_get_profiler_name_store(),
				"audio_thread(%s)", audio->info.name);
	
	while (os_event_try(audio->stop_event) == EAGAIN) {
		os_sleep_ms(AUDIO_WAIT_TIME);

		profile_start(audio_thread_name);
		pthread_mutex_lock(&audio->line_mutex);

		audio_time = os_gettime_ns() - buffer_time;
		audio_time = mix_and_output(audio, audio_time, prev_time);
		prev_time  = audio_time;

		pthread_mutex_unlock(&audio->line_mutex);
		profile_end(audio_thread_name);

		profile_reenable_thread();
	}

	return NULL;
}
开发者ID:SpaderQueen,项目名称:Gifscreen1,代码行数:31,代码来源:audio-io.c

示例13: cpd_profile_start

static void cpd_profile_start(int state, ktime_t now, int cpu)
{
	if (!is_state_cpd(state))
		return;

	profile_start(&cpd_info[to_cluster(cpu)], 0, now);
}
开发者ID:MikeForeskin,项目名称:Vindicator-S6,代码行数:7,代码来源:cpuidle_profiler.c

示例14: init_simulation

u8 init_simulation(command* cmd, simulation* sim, timer* t, ocrGuid_t** list)
{
  sim->step = 0;
  sim->steps = cmd->steps;
  sim->period = cmd->period;
  sim->dt = cmd->dt;
  sim->e_potential = 0.0;
  sim->e_kinetic = 0.0;

  u8 insane = 0;
  if(cmd->doeam)
    insane = init_eam(cmd->pot_dir, cmd->pot_name, cmd->pot_type, &sim->pot, sim->dt);
  else
    init_lj(&sim->pot, sim->dt);
  if(insane) return insane;

  real_t lattice_const = cmd->lat;
  if(cmd->lat < 0.0)
    lattice_const = sim->pot.lat;
  insane = sanity_checks(cmd, sim->pot.cutoff, lattice_const, sim->pot.lattice_type);
  if(insane) return insane;

  ocrGuid_t box_tmp;
  box** box_ptr = init_lattice(sim, cmd, lattice_const, list, &box_tmp);

  profile_start(redistribute_timer,t);
  redistribute_atoms(sim, box_ptr, sim->bxs.boxes_num);
  profile_stop(redistribute_timer,t);

  ocrDbDestroy(box_tmp);

  return 0;
}
开发者ID:shamouda,项目名称:ocr-apps,代码行数:33,代码来源:simulation.c

示例15: xferbuf_deliver

/**
 * Add received data to data transfer buffer
 *
 * @v xferbuf		Data transfer buffer
 * @v iobuf		I/O buffer
 * @v meta		Data transfer metadata
 * @ret rc		Return status code
 */
int xferbuf_deliver ( struct xfer_buffer *xferbuf, struct io_buffer *iobuf,
		      struct xfer_metadata *meta ) {
	size_t len = iob_len ( iobuf );
	size_t pos;
	int rc;

	/* Start profiling */
	profile_start ( &xferbuf_deliver_profiler );

	/* Calculate new buffer position */
	pos = xferbuf->pos;
	if ( meta->flags & XFER_FL_ABS_OFFSET )
		pos = 0;
	pos += meta->offset;

	/* Write data to buffer */
	if ( ( rc = xferbuf_write ( xferbuf, pos, iobuf->data, len ) ) != 0 )
		goto done;

	/* Update current buffer position */
	xferbuf->pos = ( pos + len );

 done:
	free_iob ( iobuf );
	profile_stop ( &xferbuf_deliver_profiler );
	return rc;
}
开发者ID:AhmadQasim,项目名称:GPU-Virtualization,代码行数:35,代码来源:xferbuf.c


注:本文中的profile_start函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。