static bool ApplyConvolutionsFloat1D(Context * context, const Renderer * r, BitmapFloat * img, const uint32_t from_row, const uint32_t row_count, double sharpening_applied) { if (r->details->kernel_a != NULL){ prof_start (context, "convolve kernel a", false); if (!BitmapFloat_convolve_rows (context, img, r->details->kernel_a, img->channels, from_row, row_count)) { CONTEXT_add_to_callstack (context); return false; } prof_stop (context, "convolve kernel a", true, false); } if (r->details->kernel_b != NULL){ prof_start (context, "convolve kernel b", false); if (!BitmapFloat_convolve_rows (context, img, r->details->kernel_b, img->channels, from_row, row_count)) { CONTEXT_add_to_callstack (context); return false; } prof_stop (context, "convolve kernel b", true, false); } if (r->details->sharpen_percent_goal > sharpening_applied + 0.01) { prof_start(context,"SharpenBgraFloatRowsInPlace", false); if (!BitmapFloat_sharpen_rows(context, img, from_row, row_count, r->details->sharpen_percent_goal - sharpening_applied)) { CONTEXT_add_to_callstack (context); return false; } prof_stop(context,"SharpenBgraFloatRowsInPlace", true, false); } return true; }
void sample(void * arg, ulong count) { mp_limb_t n, d, r = 0; double dpre; ulong i; mp_ptr array = (mp_ptr) flint_malloc(1024*sizeof(mp_limb_t)); flint_rand_t state; flint_randinit(state); for (i = 0; i < count; i++) { int j; d = n_randtest(state); if (d == 0UL) d++; dpre = n_precompute_inverse(d); for (j = 0; j < 1024; j++) { array[j] = n_randtest(state); } prof_start(); for (j = 0; j < 10000; j++) { r += n_mod2_precomp(array[j&1023], d, dpre); } prof_stop(); } if (r == 0) abort(); flint_randclear(state); flint_free(array); }
DDS_ReturnCode_t dcps_unregister_instance (DDS_DataWriter wp, const void *instance_data, int dynamic, const DDS_InstanceHandle_t handle, const FTime_t *time, DDS_InstanceHandleSeq *dests) { HCI hci; InstanceHandle h; handle_t d [MAX_DW_DESTS]; unsigned i, ndests; DDS_ReturnCode_t ret; prof_start (dcps_unregister); if (!writer_ptr (wp, 1, &ret)) return (ret); if (dests) { if (!dests->_length || !dests->_buffer) { ret = DDS_RETCODE_BAD_PARAMETER; goto done; } else if (dests->_length > MAX_DW_DESTS) { ret = DDS_RETCODE_OUT_OF_RESOURCES; goto done; } for (i = 0; i < dests->_length; i++) d [i] = dests->_buffer [i]; while (i < MAX_DW_DESTS) d [i++] = 0; ndests = dests->_length; } else ndests = 0; if (!wp->w_topic->type->type_support->ts_keys) { ret = DDS_RETCODE_PRECONDITION_NOT_MET; goto done; } if (instance_data && handle == DDS_HANDLE_NIL) { hci = handle_get (wp->w_topic, wp->w_cache, instance_data, dynamic, ENC_DATA (&wp->w_lep), &h, &ret); if (!hci) goto done; } else if (handle != DDS_HANDLE_NIL) { h = (InstanceHandle) handle; hci = NULL; } else { ret = DDS_RETCODE_BAD_PARAMETER; goto done; } ret = hc_unregister (wp->w_cache, h, hci, time, d, ndests); done: lock_release (wp->w_lock); prof_stop (dcps_unregister, 1); return (ret); }
static int sfw_be_new_change (RemReader_t *rrp, Change_t *cp, HCI hci, SequenceNumber_t *snr) { CCREF *rp; ARG_NOT_USED (snr) ctrc_printd (RTPS_ID, RTPS_SFW_BE_NEW, &rrp, sizeof (rrp)); prof_start (rtps_bw_new); RR_SIGNAL (rrp, "BE-NewChange"); #ifdef RTPS_MARKERS if (rrp->rr_writer->endpoint.mark_newch) rtps_marker_notify (rrp->rr_writer->endpoint.endpoint, EM_NEW_CHANGE, "sfw_be_new_change"); #endif rp = change_enqueue (rrp, cp, hci, CS_UNSENT); if (!rp) return (0); rp->ack_req = 1; rrp->rr_unacked++; if (!rrp->rr_unsent_changes) { rrp->rr_unsent_changes = rp; proxy_activate (&rrp->proxy); } NEW_RR_TSTATE (rrp, RRTS_PUSHING, 0); CACHE_CHECK (&rrp->rr_writer->endpoint, "sfw_be_new_change"); prof_stop (rtps_bw_new, 1); return (1); }
static void sfw_be_start (RemReader_t *rrp) { ctrc_printd (RTPS_ID, RTPS_SFW_BE_START, &rrp, sizeof (rrp)); prof_start (rtps_bw_start); RR_SIGNAL (rrp, "BE-Start"); NEW_RR_CSTATE (rrp, RRCS_INITIAL, 1); NEW_RR_CSTATE (rrp, RRCS_READY, 0); NEW_RR_TSTATE (rrp, RRTS_IDLE, 1); rrp->rr_nack_timer = NULL; #ifdef RTPS_MARKERS if (rrp->rr_writer->endpoint.mark_start) rtps_marker_notify (rrp->rr_writer->endpoint.endpoint, EM_START, "sfw_be_start"); #endif /* Add existing cache entries to reader locator/proxy queue. */ hc_replay (rrp->rr_writer->endpoint.endpoint->cache, proxy_add_change, (uintptr_t) rrp); if ((rrp->rr_unsent_changes = LIST_HEAD (rrp->rr_changes)) != NULL && rrp->rr_writer->endpoint.push_mode) { NEW_RR_TSTATE (rrp, RRTS_PUSHING, 0); proxy_activate (&rrp->proxy); } prof_stop (rtps_bw_start, 1); CACHE_CHECK (&rrp->rr_writer->endpoint, "sfw_be_start"); }
void sample(void * arg, ulong count) { mp_limb_t n; nmod_t mod; info_t * info = (info_t *) arg; mp_bitcnt_t bits = info->bits; mp_ptr vec = _nmod_vec_init(1000); mp_ptr vec2 = _nmod_vec_init(1000); mp_size_t j; long i; flint_rand_t state; flint_randinit(state); for (j = 0; j < 1000; j++) vec[j] = n_randlimb(state); prof_start(); for (i = 0; i < count; i++) { n = n_randbits(state, bits); if (n == 0UL) n++; nmod_init(&mod, n); _nmod_vec_reduce(vec2, vec, 1000, mod); } prof_stop(); flint_randclear(state); _nmod_vec_clear(vec); _nmod_vec_clear(vec2); }
// TODO: find better name static bool HalveInTempImage(Context * context, Renderer * r, int divisor) { bool result = true; prof_start(context,"create temp image for halving", false); int halved_width = (int)(r->source->w / divisor); int halved_height = (int)(r->source->h / divisor); BitmapBgra * tmp_im = BitmapBgra_create(context, halved_width, halved_height, true, r->source->fmt); if (tmp_im == NULL) { CONTEXT_add_to_callstack (context); return false; } // from here we have a temp image prof_stop(context,"create temp image for halving", true, false); if (!Halve(context, r->source, tmp_im, divisor)) { // we cannot return here, or tmp_im will leak CONTEXT_add_to_callstack (context); result = false; } tmp_im->alpha_meaningful = r->source->alpha_meaningful; if (r->destroy_source) { BitmapBgra_destroy(context,r->source); } r->source = tmp_im; r->destroy_source = true; //Cleanup tmp_im return result; }
void add_lights(int x,int y) { int xs,ys,xe,ye,in,cn,v,m; unsigned long long prof; prof=prof_start(); xs=max(1,x-LIGHTDIST); ys=max(1,y-LIGHTDIST); xe=min(MAPX-2,x+1+LIGHTDIST); ye=min(MAPY-2,y+1+LIGHTDIST); for (y=ys; y<ye; y++) { m=y*MAPX+xs; for (x=xs; x<xe; x++,m++) { if ((in=map[m].it)!=0) { if (it[in].active) { if ((v=it[in].light[1])!=0) do_add_light(x,y,v); } else { if ((v=it[in].light[0])!=0) do_add_light(x,y,v); } } if ((cn=map[m].ch)!=0) if ((v=ch[cn].light)!=0) do_add_light(x,y,v); if (map[m].flags&MF_INDOORS) compute_dlight(x,y); } } prof_stop(20,prof); }
void compute_dlight(int xc,int yc) { int xs,ys,xe,ye,x,y,v,d,best=0,m; unsigned long long prof; prof=prof_start(); xs=max(0,xc-LIGHTDIST); ys=max(0,yc-LIGHTDIST); xe=min(MAPX-1,xc+1+LIGHTDIST); ye=min(MAPY-1,yc+1+LIGHTDIST); for (y=ys; y<ye; y++) { m=y*MAPX+xs; for (x=xs; x<xe; x++,m++) { if ((xc-x)*(xc-x)+(yc-y)*(yc-y)>(LIGHTDIST*LIGHTDIST+1)) continue; if (!(map[m].flags&MF_INDOORS)) { if ((v=can_see(0,xc,yc,x,y,LIGHTDIST))==0) continue; d=256/(v*(abs(xc-x)+abs(yc-y))); if (d>best) best=d; } } } if (best>256) best=256; map[xc+yc*MAPX].dlight=best; prof_stop(18,prof); }
static bool ApplyColorMatrix(Context * context, const Renderer * r, BitmapFloat * img, const uint32_t row_count) { prof_start(context,"apply_color_matrix_float", false); bool b= BitmapFloat_apply_color_matrix(context, img, 0, row_count, r->details->color_matrix); prof_stop(context,"apply_color_matrix_float", true, false); return b; }
void sample_zmod_poly_factor(unsigned long length, unsigned long bits, void* arg, unsigned long count) { zmod_poly_t pol1, pol2, res1; zmod_poly_factor_t factors; ulong modulus = z_nextprime(z_randbits(bits), 0); zmod_poly_init(pol1, modulus); zmod_poly_init(pol2, modulus); zmod_poly_init(res1, modulus); zmod_poly_factor_init(factors); unsigned long r_count; // how often to generate new random data if (count >= 1000) r_count = 100; else if (count >= 100) r_count = 10; else if (count >= 20) r_count = 5; else if (count >= 8) r_count = 2; else r_count = 1; for (unsigned long count2 = 0; count2 < count; count2++) { if (count2 % r_count == 0) { do {modulus = z_nextprime(z_randbits(bits), 0);} while (modulus < 2); zmod_poly_clear(pol1); zmod_poly_clear(pol2); zmod_poly_clear(res1); zmod_poly_init(pol1, modulus); zmod_poly_init(pol2, modulus); zmod_poly_init(res1, modulus); do {randpoly(pol1, length, modulus); } while (pol1->length == 0); do {randpoly(pol2, length, modulus); } while (pol2->length == 0); zmod_poly_mul(res1, pol1, pol2); } #if DEBUG printf("bits = %ld, length = %ld, modulus = %ld\n", bits, length, modulus); #endif prof_start(); zmod_poly_factor(factors, res1); prof_stop(); zmod_poly_factor_clear(factors); zmod_poly_factor_init(factors); } zmod_poly_factor_clear(factors); zmod_poly_clear(pol1); zmod_poly_clear(pol2); zmod_poly_clear(res1); }
void sample_NTL_poly_div1(unsigned long length, unsigned long bits, void* arg, unsigned long count) { ZZX poly1; ZZX poly2; ZZX poly3; ZZ a; poly1.SetMaxLength(length); poly2.SetMaxLength(length); poly3.SetMaxLength(2*length-1); unsigned long r_count; // how often to generate new random data if (count >= 10000) r_count = 100; else if (count >= 100) r_count = 10; else if (count >= 20) r_count = 4; else if (count >= 8) r_count = 2; else r_count = 1; unsigned long i; for (i = 0; i < count; i++) { if (i%r_count == 0) { do { unsigned long j; for (j = 0; j < length; j++) { RandomBits(a,bits); SetCoeff(poly1,j,a); } } while (IsZero(poly1)); unsigned long j; for (j = 0; j < length; j++) { RandomBits(a,bits); SetCoeff(poly2,j,a); } } mul(poly3, poly1, poly2); prof_start(); unsigned long count2; for (count2 = 0; count2 < r_count; count2++) { divide(poly2, poly3, poly1); } prof_stop(); i += (r_count-1); } }
void sample_zmod_poly_gcd_euclidean(unsigned long length, unsigned long bits, void* arg, unsigned long count) { zmod_poly_t pol1, pol2, pol3, res1; unsigned long modulus = 2; zmod_poly_init(pol1, modulus); zmod_poly_init(pol2, modulus); zmod_poly_init(pol3, modulus); zmod_poly_init(res1, modulus); unsigned long r_count; // how often to generate new random data if (count >= 1000) r_count = 100; else if (count >= 100) r_count = 10; else if (count >= 20) r_count = 5; else if (count >= 8) r_count = 2; else r_count = 1; for (unsigned long count2 = 0; count2 < count; count2++) { if (count2 % r_count == 0) { modulus = z_nextprime(z_randbits(bits), 0); zmod_poly_clear(pol1); zmod_poly_clear(pol2); zmod_poly_clear(pol3); zmod_poly_clear(res1); zmod_poly_init(pol1, modulus); zmod_poly_init(pol2, modulus); zmod_poly_init(pol3, modulus); zmod_poly_init(res1, modulus); randpoly(pol1, length, modulus); randpoly(pol2, length, modulus); randpoly(pol3, length, modulus); zmod_poly_mul(pol1, pol1, pol3); zmod_poly_mul(pol2, pol2, pol3); } #if DEBUG printf("bits = %ld, length = %ld, modulus = %ld\n", bits, length, modulus); #endif prof_start(); zmod_poly_gcd_euclidean(res1, pol1, pol2); prof_stop(); } zmod_poly_clear(pol1); zmod_poly_clear(pol2); zmod_poly_clear(pol3); zmod_poly_clear(res1); }
void sample(void * arg, ulong count) { info_t * info = (info_t *) arg; slong length = info->length, i, j; int monic = info->monic; int scale; scale = 1000; if (length >= 50) scale = 100; if (length >= 500) scale = 40; flint_rand_t state; flint_randinit(state); fmpq_poly_t pol; nf_t nf; nf_elem_t a; fmpq_t norm; fmpq_poly_init(pol); fmpq_init(norm); for (i = 0; i < count; i++) { random_fmpq_poly(pol, state, length); if (monic) { fmpz_one(fmpq_poly_denref(pol)); fmpq_poly_set_coeff_ui(pol, length - 1, 1); } nf_init(nf, pol); nf_elem_init(a, nf); random_nf_elem(a, state, nf); if (monic) fmpz_one(fmpq_poly_denref(NF_ELEM(a))); prof_start(); for (j = 0; j < scale; j++) { nf_elem_trace(norm, a, nf); } prof_stop(); } fmpq_clear(norm); nf_elem_clear(a, nf); nf_clear(nf); fmpq_poly_clear(pol); flint_randclear(state); }
void sample(void * arg, ulong count) { mp_limb_t n, d, dinv, r = 0, norm; double dpre; info_t * info = (info_t *) arg; mp_bitcnt_t bits = info->bits; ulong type = info->type; ulong i; flint_rand_t state; flint_randinit(state); mp_ptr arr = (mp_ptr) malloc(1024*sizeof(mp_limb_t)); mp_ptr arr2 = (mp_ptr) malloc(1024*sizeof(mp_limb_t)); for (i = 0; i < count; i++) { int j; d = n_randbits(state, bits); if (d == 0UL) d++; dinv = n_preinvert_limb(d); for (j = 0; j < 1024; j++) { arr[j] = n_randbits(state, FLINT_BITS); arr2[j] = n_randint(state, n); } switch (type) { case 1: prof_start(); for (mp_size_t j = 0; j < 10000UL; j++) { r += n_lll_mod_preinv(arr2[j&1023], arr[j&1023], arr[(j+1)&1023], d, dinv); } prof_stop(); break; } } if (r == 9879875897UL) abort(); flint_randclear(state); free(arr); free(arr2); }
DDS_ReturnCode_t DDS_DomainParticipant_delete_subscriber (DDS_DomainParticipant dp, DDS_Subscriber sp) { Condition_t *cp; DDS_ReturnCode_t ret; ctrc_begind (DCPS_ID, DCPS_DP_D_SUB, &dp, sizeof (dp)); ctrc_contd (&sp, sizeof (sp)); ctrc_endd (); prof_start (dcps_delete_sub); if (!domain_ptr (dp, 1, &ret)) return (ret); if (!subscriber_ptr (sp, &ret)) goto done; if (sp->domain != dp) { ret = DDS_RETCODE_BAD_PARAMETER; goto done; } if (sp->nreaders) { log_printf (DCPS_ID, 0, "delete_subscriber(): still readers connected!\r\n"); ret = DDS_RETCODE_PRECONDITION_NOT_MET; goto done; } if (!dds_purge_notifications ((Entity_t *) sp, DDS_ALL_STATUS, 1)) { ret = DDS_RETCODE_PRECONDITION_NOT_MET; goto done; } sp->entity.flags &= ~EF_ENABLED; qos_subscriber_free (&sp->qos); /* Delete StatusCondition if it exists. */ if (sp->condition) { cp = (Condition_t *) sp->condition; if (cp->deferred) dds_defer_waitset_undo (sp, sp->condition); dcps_delete_status_condition (sp->condition); sp->condition = NULL; } subscriber_delete (sp); done: lock_release (dp->lock); prof_stop (dcps_delete_sub, 1); return (ret); }
void sample_NTL_poly_div2(unsigned long length, unsigned long bits, void* arg, unsigned long count) { ZZX poly1; ZZX poly2; ZZX poly3; ZZ a; poly1.SetMaxLength(length); poly2.SetMaxLength(length); poly3.SetMaxLength(2*length-1); unsigned long r_count; // how often to generate new random data if (count >= 1000) r_count = 100; else if (count >= 100) r_count = 10; else if (count >= 20) r_count = 5; else if (count >= 8) r_count = 2; else r_count = 1; unsigned long i; for (i = 0; i < count; i++) { if (i%r_count == 0) { unsigned long j; for (j = 0; j<length-1; j++) { RandomBits(a,bits); SetCoeff(poly1,j,a); } SetCoeff(poly1,length-1,1); unsigned long j; for (j = 0; j<2*length-1; j++) { RandomBits(a,bits); SetCoeff(poly3,j,a); } } prof_start(); div(poly2, poly3, poly1); prof_stop(); } }
void sample_zmod_poly_mul_classical_trunc_left(unsigned long length, unsigned long bits, void* arg, unsigned long count) { zmod_poly_t pol1, pol2, res1; unsigned long modulus = 2; zmod_poly_init(pol1, modulus); zmod_poly_init(pol2, modulus); zmod_poly_init(res1, modulus); unsigned long r_count; // how often to generate new random data if (count >= 1000) r_count = 100; else if (count >= 100) r_count = 10; else if (count >= 20) r_count = 5; else if (count >= 8) r_count = 2; else r_count = 1; for (unsigned long count2 = 0; count2 < count; count2++) { if (count2 % r_count == 0) { do {modulus = randbits(bits);} while (modulus < 2); zmod_poly_clear(pol1); zmod_poly_clear(pol2); zmod_poly_clear(res1); zmod_poly_init(pol1, modulus); zmod_poly_init(pol2, modulus); zmod_poly_init(res1, modulus); randpoly(pol1, length, modulus); randpoly(pol2, length, modulus); } #if DEBUG printf("bits = %ld, length = %ld, modulus = %ld\n", bits, length, modulus); #endif prof_start(); zmod_poly_mul_classical_trunc_left(res1, pol1, pol2, length); prof_stop(); } zmod_poly_clear(pol1); zmod_poly_clear(pol2); zmod_poly_clear(res1); }
void sample(void * arg, ulong count) { info_t * info = (info_t *) arg; slong limbs = info->limbs, i, j; int algo = info->algo; int scale = 200; FLINT_TEST_INIT(state); fmpz_t a, b, c, r; fmpz_preinvn_t inv; fmpz_init(a); fmpz_init(b); fmpz_init(c); fmpz_init(r); for (i = 0; i < count; i++) { fmpz_randbits(a, state, (2*limbs - 1)*FLINT_BITS); fmpz_randbits(b, state, limbs*FLINT_BITS); fmpz_preinvn_init(inv, b); prof_start(); if (algo == 1) { for (j = 0; j < scale; j++) { fmpz_fdiv_qr_preinvn(c, r, a, b, inv); } } else { for (j = 0; j < scale; j++) { fmpz_fdiv_qr(c, r, a, b); } } prof_stop(); } fmpz_preinvn_clear(inv); fmpz_clear(a); fmpz_clear(b); fmpz_clear(c); fmpz_clear(r); flint_randclear(state); }
int can_go(int _fx,int _fy,int tx,int ty) { int tmp; unsigned long long prof; prof=prof_start(); if (visi!=_visi) { visi=_visi; ox=oy=0; } if (ox!=_fx || oy!=_fy) can_map_go(_fx,_fy,15); tmp=check_vis(tx,ty); prof_stop(17,prof); return tmp; }
static void sfw_be_rem_change (RemReader_t *rrp, Change_t *cp) { ctrc_printd (RTPS_ID, RTPS_SFW_BE_REM, &rrp, sizeof (rrp)); prof_start (rtps_bw_rem); RR_SIGNAL (rrp, "BE-RemChange"); #ifdef RTPS_MARKERS if (rrp->rr_writer->endpoint.mark_rmch) rtps_marker_notify (rrp->rr_writer->endpoint.endpoint, EM_REM_CHANGE, "sfw_be_rem_change"); #endif change_remove (rrp, cp); prof_stop (rtps_bw_rem, 1); CACHE_CHECK (&rrp->rr_writer->endpoint, "sfw_be_rem_change"); }
void io_loop(void) { int n,fmax=0,tmp; fd_set in_fd,out_fd; struct timeval tv; int panic=0; unsigned long long prof; if (ticker%8) return; while (panic++<100) { FD_ZERO(&in_fd); FD_ZERO(&out_fd); fmax=0; FD_SET(io_sock,&in_fd); if (io_sock>fmax) fmax=io_sock; for (n=1; n<MAXPLAYER; n++) { if (player[n]) { if (player[n]->in_len<256) { FD_SET(player[n]->sock,&in_fd); if (player[n]->sock>fmax) fmax=player[n]->sock; } } if (player[n]) { if (player[n]->iptr!=player[n]->optr) { FD_SET(player[n]->sock,&out_fd); if (player[n]->sock>fmax) fmax=player[n]->sock; } } } tv.tv_sec=0; tv.tv_usec=0; tmp=select(fmax+1,&in_fd,&out_fd,NULL,&tv); if (tmp<1) break; if (FD_ISSET(io_sock,&in_fd)) new_player(io_sock); for (n=1; n<MAXPLAYER; n++) { if (!player[n]) continue; if (FD_ISSET(player[n]->sock,&in_fd)) { prof=prof_start(9); rec_player(n); prof_stop(9,prof); } if (!player[n]) continue; // yuck - rec_player might have kicked the player if (FD_ISSET(player[n]->sock,&out_fd)){ prof=prof_start(10); send_player(n); prof_stop(10,prof); } } } }
void sample_F_mpz_poly_mul(ulong length, ulong bits, void* arg, ulong count) { ulong m = ceil_log2(length); ulong output_bits = 2*bits+m; F_mpz_poly_t poly1, poly2, poly3; mpz_poly_t r_poly, r_poly2; mpz_poly_init(r_poly); mpz_poly_init(r_poly2); mpz_poly_realloc(r_poly, length); mpz_poly_realloc(r_poly2, length); F_mpz_poly_init2(poly1, length); F_mpz_poly_init2(poly2, length); F_mpz_poly_init2(poly3, 2*length-1); ulong r_count; // how often to generate new random data if (count >= 1000) r_count = 100; else if (count >= 100) r_count = 10; else if (count >= 20) r_count = 5; else if (count >= 8) r_count = 2; else r_count = 1; for (ulong i = 0; i < count; i++) { if (i%r_count == 0) { randpoly(r_poly, length, bits); mpz_poly_to_F_mpz_poly(poly1, r_poly); randpoly(r_poly2, length, bits); mpz_poly_to_F_mpz_poly(poly2, r_poly2); } prof_start(); F_mpz_poly_mul(poly3, poly1, poly2); prof_stop(); } mpz_poly_clear(r_poly); mpz_poly_clear(r_poly2); F_mpz_poly_clear(poly3); F_mpz_poly_clear(poly2); F_mpz_poly_clear(poly1); }
static void sfr_be_finish (RemWriter_t *rwp) { ctrc_printd (RTPS_ID, RTPS_SFR_BE_FINISH, &rwp, sizeof (rwp)); prof_start (rtps_br_finish); RW_SIGNAL (rwp, "BE-Finish"); #ifdef RTPS_MARKERS if (rwp->rw_reader->endpoint.mark_finish) rtps_marker_notify (rwp->rw_reader->endpoint.endpoint, EM_FINISH, "sfr_be_finish"); #endif /* We're done. */ NEW_RW_CSTATE (rwp, RWCS_FINAL, 0); prof_stop (rtps_br_finish, 1); }
static void psc_push_fields_fortran_pml_b(struct psc_push_fields *push, struct psc_fields *flds_base) { assert(ppsc->nr_patches == 1); struct psc_fields *flds = psc_fields_get_as(flds_base, "fortran", JXI, MU + 1); static int pr; if (!pr) { pr = prof_register("fort_field_pml_b", 1., 0, 0); } prof_start(pr); PIC_pml_msb(flds); prof_stop(pr); psc_fields_put_as(flds, flds_base, EX, BZ + 1); }
term_t cbif_profile1(proc_t *proc, term_t *regs) { term_t Flag = regs[0]; if (!is_bool(Flag)) badarg(Flag); #ifdef PROFILE_HARNESS if (Flag == A_TRUE) prof_restart(); else { uint64_t now = monotonic_clock(); prof_stop(now); } #endif return A_OK; }
static int sfw_be_send_data (RemReader_t *rrp) { int error; ctrc_printd (RTPS_ID, RTPS_SFW_BE_SEND, &rrp, sizeof (rrp)); prof_start (rtps_bw_send); RR_SIGNAL (rrp, "BE-SendData"); #ifdef RTPS_MARKERS if (rrp->rr_writer->endpoint.mark_send) rtps_marker_notify (rrp->rr_writer->endpoint.endpoint, EM_SEND, "sfw_be_send_data"); #endif error = be_send_data (rrp, (DiscoveredReader_t *) &rrp->rr_endpoint); prof_stop (rtps_bw_send, 1); return (error); }
DDS_Publisher DDS_DomainParticipant_create_publisher (DDS_DomainParticipant dp, const DDS_PublisherQos *qos, const DDS_PublisherListener *listener, DDS_StatusMask mask) { Publisher_t *up; int enable; ctrc_begind (DCPS_ID, DCPS_DP_C_PUB, &dp, sizeof (dp)); ctrc_contd (&qos, sizeof (qos)); ctrc_contd (&listener, sizeof (listener)); ctrc_contd (&mask, sizeof (mask)); ctrc_endd (); prof_start (dcps_create_pub); if (!domain_ptr (dp, 1, NULL)) return (NULL); if (qos == DDS_PUBLISHER_QOS_DEFAULT) qos = &dp->def_publisher_qos; else if (!qos_valid_publisher_qos (qos)) { up = NULL; goto done; } up = publisher_create (dp, 0); if (!up) goto done; qos_publisher_new (&up->qos, qos); if (listener) up->listener = *listener; up->mask = mask; up->def_writer_qos = qos_def_writer_qos; enable = dp->autoenable; lock_release (dp->lock); if (enable) DDS_Publisher_enable (up); return (up); done: lock_release (dp->lock); prof_stop (dcps_create_pub, 1); return (NULL); }
DDS_Subscriber DDS_DomainParticipant_create_subscriber (DDS_DomainParticipant dp, const DDS_SubscriberQos *qos, const DDS_SubscriberListener *listener, DDS_StatusMask mask) { Subscriber_t *sp; int enable; ctrc_begind (DCPS_ID, DCPS_DP_C_SUB, &dp, sizeof (dp)); ctrc_contd (&qos, sizeof (qos)); ctrc_contd (&listener, sizeof (listener)); ctrc_contd (&mask, sizeof (mask)); ctrc_endd (); prof_start (dcps_create_sub); if (!domain_ptr (dp, 1, NULL)) return (NULL); if (qos == DDS_SUBSCRIBER_QOS_DEFAULT) qos = &dp->def_subscriber_qos; else if (!qos_valid_subscriber_qos (qos)) { sp = NULL; goto done; } sp = subscriber_create (dp, 0); if (!sp) goto done; qos_subscriber_new (&sp->qos, qos); if (listener) sp->listener = *listener; sp->mask = mask; enable = dp->autoenable; lock_release (dp->lock); if (enable) DDS_Subscriber_enable (sp); prof_stop (dcps_create_sub, 1); return (sp); done: lock_release (dp->lock); return (NULL); }
static bool Renderer_complete_halving(Context * context, Renderer * r) { int divisor = r->details->halving_divisor; if (divisor <= 1) { return true; } bool result = true; prof_start(context, "CompleteHalving", false); r->details->halving_divisor = 0; //Don't halve twice result = r->source->can_reuse_space ? HalveInPlace (context, r->source, divisor) : HalveInTempImage (context, r, divisor); if (!result){ CONTEXT_add_to_callstack (context); } prof_stop(context,"CompleteHalving", true, false); return result; }