本文整理汇总了C++中CLOCK函数的典型用法代码示例。如果您正苦于以下问题:C++ CLOCK函数的具体用法?C++ CLOCK怎么用?C++ CLOCK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CLOCK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DestroyGrid
void
DestroyGrid (long my_id, time_info *local_time, long time_all)
{
box *b_scan, *tb;
particle *p;
long i;
long particle_cost;
unsigned long start = 0, finish;
if (time_all)
CLOCK(start);
b_scan = Local[my_id].Childless_Partition;
MY_NUM_PARTICLES = 0;
while (b_scan != NULL) {
tb = b_scan;
b_scan = b_scan->next;
particle_cost = tb->cost / tb->num_particles;
for (i = 0; i < tb->num_particles; i++) {
if (MY_MAX_PARTICLES <= MY_NUM_PARTICLES) {
LockedPrint("ERROR (P%d) : Too many particles in local array\n", my_id);
exit(-1);
}
p = tb->particles[i];
p->cost = particle_cost;
MY_PARTICLES[MY_NUM_PARTICLES++] = p;
}
}
if (my_id == 0)
Grid = NULL;
if (time_all) {
CLOCK(finish);
local_time[MY_TIME_STEP].other_time += finish - start;
}
}
示例2: display_other_heuristics
void display_other_heuristics(tm_topology_t *topology,int N,double **comm,double **arch){
CLOCK_T time1,time0;
double duration;
int *sol;
sol=(int*)malloc(sizeof(int)*N);
map_Packed(topology,N,sol);
printf("Packed: ");
print_sol(N,sol,comm,arch);
map_RR(N,sol);
printf("RR: ");
print_sol(N,sol,comm,arch);
CLOCK(time0);
map_MPIPP(topology,1,N,sol,comm,arch);
CLOCK(time1);
duration=CLOCK_DIFF(time1,time0);
printf("MPIPP-1-D:%f\n",duration);
printf("MPIPP-1: ");
print_sol(N,sol,comm,arch);
CLOCK(time0);
map_MPIPP(topology,5,N,sol,comm,arch);
CLOCK(time1);
duration=CLOCK_DIFF(time1,time0);
printf("MPIPP-5-D:%f\n",duration);
printf("MPIPP-5: ");
print_sol(N,sol,comm,arch);
free(sol);
}
示例3: firmware
void firmware() {
display_init();
gfx_init_ctxt(&gfx_ctxt, display_init_framebuffer(), 720, 1280, 768);
gfx_clear_color(&gfx_ctxt, 0xFF000000);
gfx_con_init(&gfx_con, &gfx_ctxt);
gfx_con_setcol(&gfx_con, DEFAULT_TEXT_COL, 0, 0);
while (!sdMount()) {
error("Failed to init SD card!\n");
print("Press POWER to power off, any other key to retry\n");
if (btn_wait() & BTN_POWER)
i2c_send_byte(I2C_5, 0x3C, MAX77620_REG_ONOFFCNFG1, MAX77620_ONOFFCNFG1_PWR_OFF);
btn_wait();
}
if(PMC(APBDEV_PMC_SCRATCH49) != 69 && fopen("/ReiNX.bin", "rb")) {
fread((void*)PAYLOAD_ADDR, fsize(), 1);
fclose();
sdUnmount();
display_end();
CLOCK(CLK_RST_CONTROLLER_CLK_OUT_ENB_V) |= 0x400; // Enable AHUB clock.
CLOCK(CLK_RST_CONTROLLER_CLK_OUT_ENB_Y) |= 0x40; // Enable APE clock.
PMC(APBDEV_PMC_SCRATCH49) = 69;
((void (*)())PAYLOAD_ADDR)();
}
SYSREG(AHB_AHB_SPARE_REG) = (volatile vu32)0xFFFFFF9F;
PMC(APBDEV_PMC_SCRATCH49) = 0;
print("Welcome to ReiNX %s!\n", VERSION);
loadFirm();
drawSplash();
launch();
}
示例4: PalEvidence
void PalEvidence(char* tpal,char* pal)
{
const int SPEED = 4;
int log = 1,i;
int t;
while(log) {
t = CLOCK();
while(CLOCK() < t + 1);
log = 0;
for(i = 0; i < 256; i++) {
tpal[3*i + 0] += SPEED;
tpal[3*i + 1] += SPEED;
tpal[3*i + 2] += SPEED;
if(tpal[3*i + 0] >= pal[3*i + 0]) tpal[3*i + 0] = pal[3*i + 0];
else log = 1;
if(tpal[3*i + 1] >= pal[3*i + 1]) tpal[3*i + 1] = pal[3*i + 1];
else log = 1;
if(tpal[3*i + 2] >= pal[3*i + 2]) tpal[3*i + 2] = pal[3*i + 2];
else log = 1;
}
XGR_SetPal(tpal,0,255);
XGR_Flush(0,0,XGR_MAXX,XGR_MAXY);
xtClearMessageQueue();
}
}
示例5: main
int main(int argc, char **argv) {
int n,i,j;
double **a;
double *b, count=1.0;
unsigned int t1,t2;
MAIN_INITENV
if (argc!=2) {
printf("Usage: bksb <size>\nAborting...\n");
exit(0);
}
n = atoi(argv[1]);
a = (double**)G_MALLOC(n*sizeof(double*));
for(i = 0; i < n; i++) {
a[i] = (double*)G_MALLOC(n*sizeof(double));
for(j = i;j < n;j++) {
a[i][j] = count;
count++;
}
}
b = (double*)G_MALLOC(n*sizeof(double));
for(i = 0; i < n; i++) {
b[i] = count;
count++;
}
CLOCK(t1)
bksb(a,b,n);
CLOCK(t2)
printf("Elapsed: %u microseconds\n",t2-t1);
for(i = 0; i < n; i++) printf("%lf ", b[i]);
printf("\n");
MAIN_END
return 0;
}
示例6: clock_disable
void clock_disable(const clock_t *clk)
{
//Put clock into reset.
CLOCK(clk->reset) = (CLOCK(clk->reset) & ~(1 << clk->index)) | (1 << clk->index);
//Disable.
CLOCK(clk->enable) &= ~(1 << clk->index);
}
示例7: mc_enable_ahb_redirect
void mc_enable_ahb_redirect()
{
CLOCK(0x3A4) = CLOCK(0x3A4) & 0xFFF7FFFF | 0x80000;
//MC(MC_IRAM_REG_CTRL) &= 0xFFFFFFFE;
MC(MC_IRAM_BOM) = 0x40000000;
MC(MC_IRAM_TOM) = 0x4003F000;
}
示例8: ConstructGrid
void
ConstructGrid (long my_id, time_info *local_time, long time_all)
{
unsigned long init = 0, start = 0, finish;
if (time_all)
CLOCK(init);
DetermineGridSize(my_id); /* Finds the four corners of the grid. */
FreeBoxes(my_id);
InitPartition(my_id);
if (time_all)
CLOCK(start);
if (MY_NUM_PARTICLES > 0) {
ConstructLocalGrid(my_id); /* Each processor constructs their own tree
based on only their particles */
MergeLocalGrid(my_id); /* The processors combine their trees into one
global tree. This step contains
communication between processors. */
}
BARRIER(G_Memory->synch, Number_Of_Processors);
CleanupGrid(my_id);
if (time_all)
CLOCK(finish);
if (time_all) {
local_time[MY_TIME_STEP].other_time = start - init;
local_time[MY_TIME_STEP].construct_time = finish - start;
}
}
示例9: main
int main (int argc, string argv[])
#endif
{
#ifndef SIM_SOCLIB
long c;
while ((c = getopt(argc, argv, "h")) != -1) {
switch(c) {
case 'h':
Help();
exit(-1);
break;
default:
fprintf(stderr, "Only valid option is \"-h\".\n");
exit(-1);
break;
}
}
#endif
Global = NULL;
initparam(defv);
startrun();
initoutput();
tab_init();
Global->tracktime = 0;
Global->partitiontime = 0;
Global->treebuildtime = 0;
Global->forcecalctime = 0;
Global->current_id = 0;
CLOCK(Global->computestart);
printf("COMPUTESTART = %12lu\n",Global->computestart);
CREATE(SlaveStart, NPROC);
WAIT_FOR_END(NPROC);
CLOCK(Global->computeend);
printf("COMPUTEEND = %12lu\n",Global->computeend);
printf("COMPUTETIME = %12lu\n",Global->computeend - Global->computestart);
printf("TRACKTIME = %12lu\n",Global->tracktime);
printf("PARTITIONTIME = %12lu\t%5.2f\n",Global->partitiontime,
((float)Global->partitiontime)/Global->tracktime);
printf("TREEBUILDTIME = %12lu\t%5.2f\n",Global->treebuildtime,
((float)Global->treebuildtime)/Global->tracktime);
printf("FORCECALCTIME = %12lu\t%5.2f\n",Global->forcecalctime,
((float)Global->forcecalctime)/Global->tracktime);
printf("RESTTIME = %12lu\t%5.2f\n",
Global->tracktime - Global->partitiontime -
Global->treebuildtime - Global->forcecalctime,
((float)(Global->tracktime-Global->partitiontime-
Global->treebuildtime-Global->forcecalctime))/
Global->tracktime);
MAIN_END;
}
示例10: main
int main(int argc,char **argv) {
int i,j,p,n;
double **a,*b, count=1.0;
unsigned int t1,t2;
MAIN_INITENV
if (argc!=3) {
printf("Usage: pbksb P N\nAborting...\n");
exit(0);
}
gm = (GM*)G_MALLOC(sizeof(GM));
p = gm->p = atoi(argv[1]);
gm->n = atoi(argv[2]);
assert(p > 0);
assert(p <= 8);
n = gm->n;
a = gm->a = (double**)G_MALLOC(n*sizeof(double*));
for(i = 0; i < n; i++) {
a[i] = (double*)G_MALLOC(n*sizeof(double));
for(j = i;j < n;j++){
a[i][j] = count;
count++;
}
}
//-----------------------------------------------
// Create 1D array a_prime and map a to a_prime
//-----------------------------------------------
gm->a_prime = (double*)G_MALLOC((n+1)*n/2*sizeof(double))
mapping();
b = gm->b = (double*)G_MALLOC(n*sizeof(double));
for(i = 0; i < n; i++) {
b[i] = count;
count++;
}
gm->pse = (char*)G_MALLOC(n*sizeof(char));
for(i = 0; i < n; i++)
CLEARPAUSE(gm->pse[i])
for(i = 0; i < p-1; i++)
CREATE(pbksb)
CLOCK(t1)
pbksb();
WAIT_FOR_END(p-1)
CLOCK(t2)
printf("Elapsed: %u us\n",t2-t1);
for(i = 0; i < n; i++) printf("%lf ", gm->b[i]);
printf("\n");
for(i = 0; i < n; i++)
G_FREE(a[i],n*sizeof(double))
G_FREE(a,n*sizeof(double*))
G_FREE(b,n*sizeof(double))
G_FREE(gm->a_prime, (n+1)*n/2*sizeof(double))
MAIN_END
return 0;
}
示例11: UNCLOCK
void CServer::DoPulse()
{
UNCLOCK( "Top", "Other" );
if ( m_pGame )
{
CLOCK( "Top", "Game->DoPulse" );
m_pGame->DoPulse ();
UNCLOCK( "Top", "Game->DoPulse" );
}
CLOCK( "Top", "Other" );
}
示例12: PartitionGrid
void
PartitionGrid (long my_id, time_info *local_time, long time_all)
{
unsigned long start = 0, finish;
if (time_all)
CLOCK(start);
if (Partition_Flag == COST_ZONES)
CostZones(my_id);
if (time_all) {
CLOCK(finish);
local_time[MY_TIME_STEP].partition_time = finish - start;
}
}
示例13: _clock_sdmmc_clear_reset
static void _clock_sdmmc_clear_reset(u32 id)
{
switch (id)
{
case SDMMC_1:
CLOCK(CLK_RST_CONTROLLER_RST_DEV_L_CLR) = L_CLR_SDMMC1_RST;
case SDMMC_2:
CLOCK(CLK_RST_CONTROLLER_RST_DEV_L_CLR) = L_CLR_SDMMC2_RST;
case SDMMC_3:
CLOCK(CLK_RST_CONTROLLER_RST_DEV_U_CLR) = U_CLR_SDMMC3_RST;
case SDMMC_4:
CLOCK(CLK_RST_CONTROLLER_RST_DEV_L_CLR) = L_CLR_SDMMC4_RST;
}
}
示例14: _clock_sdmmc_clear_enable
static void _clock_sdmmc_clear_enable(u32 id)
{
switch (id)
{
case SDMMC_1:
CLOCK(CLK_RST_CONTROLLER_CLK_ENB_L_CLR) = L_CLR_CLK_ENB_SDMMC1;
case SDMMC_2:
CLOCK(CLK_RST_CONTROLLER_CLK_ENB_L_CLR) = L_CLR_CLK_ENB_SDMMC2;
case SDMMC_3:
CLOCK(CLK_RST_CONTROLLER_CLK_ENB_U_CLR) = U_CLR_CLK_ENB_SDMMC3;
case SDMMC_4:
CLOCK(CLK_RST_CONTROLLER_CLK_ENB_L_CLR) = L_CLR_CLK_ENB_SDMMC4;
}
}
示例15: _clock_sdmmc_is_reset
static int _clock_sdmmc_is_reset(u32 id)
{
switch (id)
{
case SDMMC_1:
return CLOCK(CLK_RST_CONTROLLER_RST_DEVICES_L) & L_SWR_SDMMC1_RST;
case SDMMC_2:
return CLOCK(CLK_RST_CONTROLLER_RST_DEVICES_L) & L_SWR_SDMMC2_RST;
case SDMMC_3:
return CLOCK(CLK_RST_CONTROLLER_RST_DEVICES_U) & U_SWR_SDMMC3_RST;
case SDMMC_4:
return CLOCK(CLK_RST_CONTROLLER_RST_DEVICES_L) & L_SWR_SDMMC4_RST;
}
return 0;
}