• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ prof_start函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ApplyConvolutionsFloat1D

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;
}
开发者ID:KirylKovaliov,项目名称:resizer,代码行数:28,代码来源:renderer.c


示例2: io_loop

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); }
                }
        }
}
开发者ID:AstoniaDev,项目名称:v3.0-server,代码行数:48,代码来源:io.c


示例3: send_player

static void send_player(int nr)
{
        int ret,len;
        unsigned long long prof;

        if (player[nr]->iptr<player[nr]->optr) {
                len=OBUFSIZE-player[nr]->optr;
        } else {
                len=player[nr]->iptr-player[nr]->optr;
        }

	//xlog("rem: iptr=%d, optr=%d, len=%d",player[nr]->iptr,player[nr]->optr,len);

        prof=prof_start(11); ret=send(player[nr]->sock,player[nr]->obuf+player[nr]->optr,len,0); prof_stop(11,prof);
        if (ret==-1) {  // send failure
		//xlog("send failure, kicking player %d",nr);
                kick_player(nr,NULL);
                return;
        }

        player[nr]->optr+=ret;

        if (player[nr]->optr==OBUFSIZE) player[nr]->optr=0;

	sent_bytes_raw+=ret+60;
	sent_bytes+=ret;
}
开发者ID:AstoniaDev,项目名称:v3.0-server,代码行数:27,代码来源:io.c


示例4: add_lights

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);
}
开发者ID:AstoniaDev,项目名称:openMerc,代码行数:34,代码来源:helper.c


示例5: HalveInTempImage

// 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;
}
开发者ID:KirylKovaliov,项目名称:resizer,代码行数:29,代码来源:renderer.c


示例6: ApplyColorMatrix

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;
}
开发者ID:KirylKovaliov,项目名称:resizer,代码行数:7,代码来源:renderer.c


示例7: sfw_be_new_change

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);
}
开发者ID:GerardoPardo,项目名称:tinq-core,代码行数:33,代码来源:rtps_sfbw.c


示例8: sfw_be_start

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");
}
开发者ID:GerardoPardo,项目名称:tinq-core,代码行数:29,代码来源:rtps_sfbw.c


示例9: sample

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);
}
开发者ID:goens,项目名称:flint2,代码行数:35,代码来源:p-mod2_precomp.c


示例10: dcps_unregister_instance

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);
}
开发者ID:ros2,项目名称:tinq-core,代码行数:60,代码来源:dcps_writer.c


示例11: sample

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);
}
开发者ID:goens,项目名称:flint2,代码行数:31,代码来源:p-reduce.c


示例12: compute_dlight

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);
}
开发者ID:AstoniaDev,项目名称:openMerc,代码行数:28,代码来源:helper.c


示例13: sample_NTL_poly_div1

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);
   }  
}
开发者ID:curtisbright,项目名称:flint1.6,代码行数:58,代码来源:NTL-profile.c


示例14: sample_zmod_poly_factor

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);  
}
开发者ID:hperl,项目名称:flint,代码行数:58,代码来源:zmod_poly-profile.c


示例15: sample

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);
}
开发者ID:videlec,项目名称:e-antic,代码行数:57,代码来源:p-trace.c


示例16: sample_zmod_poly_gcd_euclidean

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);  
}
开发者ID:hperl,项目名称:flint,代码行数:57,代码来源:zmod_poly-profile.c


示例17: init_prof_test

void
init_prof_test(void **state)
{
    if (stbbr_start(STBBR_LOGDEBUG ,5230, 0) != 0) {
        assert_true(FALSE);
        return;
    }

    config_orig = getenv("XDG_CONFIG_HOME");
    data_orig = getenv("XDG_DATA_HOME");

    setenv("XDG_CONFIG_HOME", XDG_CONFIG_HOME, 1);
    setenv("XDG_DATA_HOME", XDG_DATA_HOME, 1);

    _cleanup_dirs();

    _create_config_dir();
    _create_data_dir();
    _create_chatlogs_dir();
    _create_logs_dir();

    prof_start();
    assert_true(prof_output_exact("Profanity"));

    // set UI options to make expect assertions faster and more reliable
    prof_input("/inpblock timeout 5");
    assert_true(prof_output_exact("Input blocking set to 5 milliseconds"));
    prof_input("/inpblock dynamic off");
    assert_true(prof_output_exact("Dynamic input blocking disabled"));
    prof_input("/notify chat off");
    assert_true(prof_output_exact("Chat notifications disabled"));
    prof_input("/notify room off");
    assert_true(prof_output_exact("Room notifications disabled"));
    prof_input("/wrap off");
    assert_true(prof_output_exact("Word wrap disabled"));
    prof_input("/roster hide");
    assert_true(prof_output_exact("Roster disabled"));
    prof_input("/time console off");
    prof_input("/time console off");
    assert_true(prof_output_exact("Console time display disabled."));
    prof_input("/time chat off");
    assert_true(prof_output_exact("Chat time display disabled."));
    prof_input("/time muc off");
    assert_true(prof_output_exact("MUC time display disabled."));
    prof_input("/time mucconfig off");
    assert_true(prof_output_exact("MUC config time display disabled."));
    prof_input("/time private off");
    assert_true(prof_output_exact("Private chat time display disabled."));
    prof_input("/time xml off");
    assert_true(prof_output_exact("XML Console time display disabled."));
}
开发者ID:0xPoly,项目名称:profanity,代码行数:51,代码来源:proftest.c


示例18: sample

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);
}
开发者ID:hemmecke,项目名称:flint2,代码行数:50,代码来源:p-lll_mod_preinv.c


示例19: sample_zmod_poly_mul_classical_trunc_left

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);  
}
开发者ID:hperl,项目名称:flint,代码行数:50,代码来源:zmod_poly-profile.c


示例20: sample_NTL_poly_div2

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();
   }
   
   
}
开发者ID:curtisbright,项目名称:flint1.6,代码行数:50,代码来源:NTL-profile.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ prof_stop函数代码示例发布时间:2022-05-30
下一篇:
C++ product函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap