本文整理汇总了C++中prof_stop函数的典型用法代码示例。如果您正苦于以下问题:C++ prof_stop函数的具体用法?C++ prof_stop怎么用?C++ prof_stop使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prof_stop函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
示例5: 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");
}
示例6: 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);
}
示例7: 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;
}
示例8: 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);
}
示例9: 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);
}
示例10: 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;
}
示例11: 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);
}
示例12: 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);
}
}
示例13: 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);
}
示例14: 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);
}
示例15: 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);
}