/* set a timer to a specific value */ TIMEVAL timer_dup(TIMEVAL b) { TIMEVAL a; TIMER_RESET(a); a.tv_sec = b.tv_sec; a.tv_usec = b.tv_usec; return a; }
void benchmark( FT_Face face, btest_t* test, int max_iter, double max_time ) { int n, done; btimer_t timer, elapsed; if ( test->cache_first ) { if ( !cache_man ) { printf( "%-25s : no cache manager\n", test->title ); return; } TIMER_RESET( &timer ); test->bench( &timer, face, test->user_data ); } printf( "%-25s : ", test->title ); fflush( stdout ); n = done = 0; TIMER_RESET( &timer ); TIMER_RESET( &elapsed ); for ( n = 0; !max_iter || n < max_iter; n++ ) { TIMER_START( &elapsed ); done += test->bench( &timer, face, test->user_data ); TIMER_STOP( &elapsed ); if ( TIMER_GET( &elapsed ) > max_time ) break; } printf("%5.3f us/op\n", TIMER_GET( &timer ) * 1E6 / (double)done); }
// run with -p 20 -l 5000 int main(int argc, char *argv[]) { struct item items[MAX_ITEMS]; /* array of items */ int n, capacity, sol, benchmark, help; char filename[100]; my_timer_t t; /* standard benchmark options */ strcpy(filename, "knapsack-example3.input"); #ifdef CILK_BLOCK cilk_io_init(); #endif get_options(argc, argv, specifiers, opt_types, &prob, &length, filename, &benchmark, &help); if (help) return usage(); if (benchmark) { switch (benchmark) { case 1: /* short benchmark options -- a little work */ strcpy(filename, "knapsack-example1.input"); break; case 2: /* standard benchmark options */ strcpy(filename, "knapsack-example2.input"); break; case 3: /* long benchmark options -- a lot of work */ strcpy(filename, "knapsack-example3.input"); break; } } if (read_input(filename, items, &capacity, &n)) return 1; /* Timing. "Start" timers */ cilk_sync; printf("prob = %lu\tlength=%lu\tn = %lu\n", prob, length, n); TIMER_RESET(t); TIMER_START(t); sol = cilk_spawn knapsack(items, capacity, n, 0); cilk_sync; TIMER_STOP(t); #ifdef CILK_BLOCK cilk_io_teardown(); #endif printf("\nCilk Example: knapsack\n"); printf("options: problem-file = %s\n\n", filename); printf("Best value is %d\n\n", sol); printf("Running time = %4f s\n", TIMER_EVAL(t)); return 0; }
/* sets and returns current time from system time */ TIMEVAL set_time_now(void) { int old_errno = errno; /* init timer */ TIMER_RESET(time_now); monotonic_gettimeofday(&time_now); errno = old_errno; return time_now; }
/* current time */ TIMEVAL timer_now(void) { TIMEVAL curr_time; int old_errno = errno; /* init timer */ TIMER_RESET(curr_time); monotonic_gettimeofday(&curr_time); errno = old_errno; return curr_time; }
/* timer add */ TIMEVAL timer_add_long(TIMEVAL a, long b) { TIMEVAL ret; TIMER_RESET(ret); ret.tv_usec = a.tv_usec + b % TIMER_HZ; ret.tv_sec = a.tv_sec + b / TIMER_HZ; if (ret.tv_usec >= TIMER_HZ) { ret.tv_sec++; ret.tv_usec -= TIMER_HZ; } return ret; }
/* timer sub */ TIMEVAL timer_sub(TIMEVAL a, TIMEVAL b) { TIMEVAL ret; TIMER_RESET(ret); ret.tv_usec = a.tv_usec - b.tv_usec; ret.tv_sec = a.tv_sec - b.tv_sec; if (ret.tv_usec < 0) { ret.tv_usec += TIMER_HZ; ret.tv_sec--; } return ret; }
/* Timer functions */ static TIMEVAL vrrp_compute_timer(const int fd) { vrrp_rt *vrrp; element e; list l = &vrrp_data->vrrp_index_fd[fd%1024 + 1]; TIMEVAL timer; /* Multiple instances on the same interface */ TIMER_RESET(timer); for (e = LIST_HEAD(l); e; ELEMENT_NEXT(e)) { vrrp = ELEMENT_DATA(e); if (timer_cmp(vrrp->sands, timer) < 0 || TIMER_ISNULL(timer)) timer = timer_dup(vrrp->sands); } return timer; }
/* sock_dgram /UCP handler */ void ev_udp_handler(int fd, int ev_flags, void *arg) { int i = 0, n = 0, nevdnsbuf = 0, reqfd = -1, respfd = -1; unsigned char evdnsbuf[EVDNS_BUF_SIZE], *p = NULL; char ip[DNS_IP_MAX]; HOSTENT hostent = {0}; if(ev_flags & E_READ) { //if( ( n = recvfrom(fd, buffer[fd], EV_BUF_SIZE, 0, (struct sockaddr *)&rsa, &rsa_len)) > 0 ) if( ( n = read(fd, buffer[fd], EV_BUF_SIZE)) > 0 ) { TIMER_SAMPLE(timer); evdns_parse_reply((unsigned char *)buffer[fd], n, &hostent); if(hostent.naddrs > 0) { fprintf(stdout, "time:%lld QID:%d name:%s nalias:%d naddrs:%d\n", PT_LU_USEC(timer), hostent.qid, hostent.name, hostent.nalias, hostent.naddrs); for(i = 0; i < hostent.nalias; i++) { fprintf(stdout, "alias%d:%s\n", i, hostent.alias[i]); } for(i = 0; i < hostent.naddrs; i++) { p = (unsigned char *)&(hostent.addrs[i]); sprintf(ip, "%d.%d.%d.%d", *p, *(p+1), *(p+2), *(p+3)); fprintf(stdout, "ip[%d] [%d][%s:][%d]\n", i, hostent.addrs[i], ip, inet_addr(ip)); } fprintf(stdout, "\r\n"); } if((respfd = open("/tmp/dns.response", O_CREAT|O_RDWR, 0644)) > 0) { if(write(respfd, buffer[fd], n) <= 0)_exit(-1); close(respfd); respfd = -1; _exit(-1); } SHOW_LOG("Read %d bytes from %d", n, fd); buffer[fd][n] = 0; SHOW_LOG("Updating event[%p] on %d ", &events[fd], fd); event_add(&events[fd], E_WRITE); } else { if(n < 0 ) FATAL_LOG("Reading from %d failed, %s", fd, strerror(errno)); goto err; } } if(ev_flags & E_WRITE) { nevdnsbuf = evdns_make_query(domain, 1, 1, 1, 1, evdnsbuf); if((reqfd = open("/tmp/dns.query", O_CREAT|O_RDWR, 0644)) > 0) { if(write(reqfd, evdnsbuf, nevdnsbuf) <= 0)_exit(-1); close(reqfd); reqfd = -1; } //if( (n = write(fd, buffer[fd], strlen(buffer[fd])) ) > 0 ) if((n = write(fd, evdnsbuf, nevdnsbuf)) > 0) { SHOW_LOG("Wrote %d bytes via %d", n, fd); TIMER_RESET(timer); } else { if(n < 0) FATAL_LOG("Wrote data via %d failed, %s", fd, strerror(errno)); goto err; } event_del(&events[fd], E_WRITE); } return ; err: { event_destroy(&events[fd]); shutdown(fd, SHUT_RDWR); close(fd); SHOW_LOG("Connection %d closed", fd); } }
//rm -rf /tmp/1.idx* && gcc -O2 -o lkv lkv.c -DLKV_TEST -DTEST_KV -DHAVE_PTHREAD -lpthread && ./lkv int main() { LKV *lkv = NULL; int i = 0, j = 0, n = 0, total = 0, no = 0, stat[MASK], stat2[MASK], v = 0, num = 1000000, base = 60000000; int64_t val = 0, from = 0, to = 0, *res = NULL, all_mask = 200000; int64_t inputs[256], nos[256], last[256], tall[200000]; int64_t all = 0; time_t stime = 0, etime = 0; void *timer = NULL; if((lkv = lkv_init("/tmp/1.idx"))) { res = (int64_t *)calloc(base, sizeof(int64_t)); TIMER_INIT(timer); #ifdef TEST_KV TIMER_RESET(timer); for(i = 0; i < num; i++) { no = random()%base; LKV_SET(lkv, no, i); } TIMER_SAMPLE(timer); fprintf(stdout, "set(%d) time used:%lld\n", num, PT_LU_USEC(timer)); TIMER_RESET(timer); for(i = 0; i < num; i++) { no = random()%base; v = LKV_GET(lkv, no); } fprintf(stdout, "get(%d) time used:%lld\n", num, PT_LU_USEC(timer)); #endif #ifdef TEST_RFROM lkv_set(lkv, 1, 22); lkv_set(lkv, 2, 25); lkv_set(lkv, 3, 20); lkv_set(lkv, 4, 13); lkv_set(lkv, 6, 22); n = lkv_rangefrom(lkv, 21, NULL); fprintf(stdout, "rangefrom(21) => %d\n", n); #endif #ifdef TEST_DEB /* n = lkv_in(lkv, 16615, NULL); fprintf(stdout, "16615:%d\n", n); */ n = 0; for(i = 0; i < lkv->state->count; i++) { /* if(lkv->slots[i].min <= 26650 && lkv->slots[i].max >= 26650) { fprintf(stdout, "%d:[min:%d max:%d]\n", i, lkv->slots[i].min, lkv->slots[i].max); } */ n+= lkv->slots[i].count; } fprintf(stdout, "total:%d\n", n); #endif #ifdef TEST_IN for(i = 0; i < all_mask; i++) { tall[i] = 0; } for(i = 80000000; i > 0; i--) { no = (rand()%all_mask); lkv_set(lkv, i, no); tall[no]++; } for(i = 0; i < all_mask; i++) { n = lkv_in(lkv, i, NULL); if(n != tall[i]) fprintf(stdout, "%d:[%d/%d]\n", i, n, tall[i]); } #endif #ifdef TEST_ALL for(i = 0; i < all_mask; i++) { tall[i] = 0; } for(i = 80000000; i > 0; i--) { no = (rand()%all_mask); lkv_set(lkv, i, no); tall[no]++; } no = (rand()%all_mask); total = 0;for(i = no; i < all_mask; i++) total += tall[i]; fprintf(stdout, "rangefrom(%d):%d/%d\n", no, lkv_rangefrom(lkv, no, NULL), total); total = 0;for(i = 0; i <= no; i++) total += tall[i]; fprintf(stdout, "rangeto(%d):%d/%d\n", no, lkv_rangeto(lkv, no, NULL), total); from = (rand()%all_mask); to = (rand()%all_mask); if(from > to){from += to; to = from - to; from = from - to;} total = 0;for(i = from; i <= to; i++) total += tall[i]; fprintf(stdout, "range(%d,%d):%d/%d\n", from, no, lkv_range(lkv, from, to, NULL), total); for(i = 0; i < all_mask; i++) { n = lkv_in(lkv, i, NULL); if(n != tall[i]) fprintf(stdout, "%d:[%d/%d]\n", i, n, tall[i]); } #endif #ifdef TEST_INS //fprintf(stdout, "sizeof(stat):%d\n", sizeof(stat)); memset(stat, 0, sizeof(stat)); memset(stat2, 0, sizeof(stat2)); srand(time(NULL)); n = 256; for(i = 0; i < n; i++) { no = (rand()%MASK); nos[i] = no; if((i % 3) == 0) inputs[i] = no * -1; else inputs[i] = no; } TIMER_RESET(timer); for(i = 1; i < 20000000; i++) { j = (rand()%n); val = inputs[j]; no = nos[j]; stat[no]++; lkv_set(lkv, i, val); last[j] = i; } TIMER_SAMPLE(timer); fprintf(stdout, "set() 40000000 data, time used:%lld\n", PT_LU_USEC(timer)); TIMER_RESET(timer); for(i = 0; i < n; i++) { lkv_del(lkv, last[i]); } TIMER_SAMPLE(timer); fprintf(stdout, "del() time used:%lld\n", PT_LU_USEC(timer)); TIMER_RESET(timer); for(i = 0; i < n; i++) { val = inputs[i]; no = nos[i]; stat2[no] = lkv_in(lkv, val, res); } TIMER_SAMPLE(timer); fprintf(stdout, "in() time used:%lld\n", PT_LU_USEC(timer)); TIMER_RESET(timer); total = lkv_ins(lkv, inputs, n, NULL); TIMER_SAMPLE(timer); fprintf(stdout, "ins(keys, NULL) total:%d time used:%lld\n", total, PT_LU_USEC(timer)); TIMER_RESET(timer); total = lkv_ins(lkv, inputs, n, res); TIMER_SAMPLE(timer); fprintf(stdout, "ins(keys, res:%p) total:%d time used:%lld\n", res, total, PT_LU_USEC(timer)); for(i = 0; i < n; i++) { j = nos[i]; if(stat[j] != stat2[j]) fprintf(stdout, "%d:%d/%d::%d\n", j, stat[j], stat2[j], inputs[i]); } #ifdef OUT_ALL for(i = 0; i < total; i++) { fprintf(stdout, "%d:%d\n", i, res[i]); } #endif #endif /* for(i = 0; i < lkv->state->count; i++) { fprintf(stdout, "%d:{min:%d max:%d}(%d)\n", i, lkv->slots[i].min, lkv->slots[i].max, lkv->slots[i].count); } */ #ifdef TEST_RANGEFILTER lkv_set(lkv, 1, 1234567); lkv_set(lkv, 2, 1567890); fprintf(stdout, "rangefrom():%d\n", lkv_rangefrom(lkv, 1569000, NULL)); fprintf(stdout, "rangeto():%d\n", lkv_rangeto(lkv, 1111111, NULL)); fprintf(stdout, "range():%d\n", lkv_range(lkv, 1111111, 1400000, NULL)); #endif #ifdef TEST_RANGE srand(time(NULL)); TIMER_RESET(timer); for(i = 1; i < 40000000; i++) { val = 1356969600 + (rand()%31536000); lkv_set(lkv, i, val); } TIMER_SAMPLE(timer); fprintf(stdout, "set() 40000000 timestamps, time used:%lld\n", PT_LU_USEC(timer)); srand(time(NULL)); TIMER_RESET(timer); all = 0; for(i = 0; i < 1000; i++) { val = 1356969600 + (rand()%31536000); all += lkv_rangefrom(lkv, val, res); } TIMER_SAMPLE(timer); fprintf(stdout, "rangefrom() 1000 times total:%lld, time used:%lld\n", (long long int)all, PT_LU_USEC(timer)); srand(time(NULL)); TIMER_RESET(timer); all = 0; for(i = 0; i < 1000; i++) { val = 1356969600 + (rand()%31536000); all += lkv_rangeto(lkv, val, res); } TIMER_SAMPLE(timer); fprintf(stdout, "rangeto() 1000 times total:%lld, time used:%lld\n", (long long int)all, PT_LU_USEC(timer)); srand(time(NULL)); TIMER_RESET(timer); all = 0; for(i = 0; i < 1000; i++) { from = 1356969600 + (rand()%31536000); to = from + rand()%31536000; all += lkv_range(lkv, from, to, res); } TIMER_SAMPLE(timer); fprintf(stdout, "range(%p) 1000 times total:%lld, time used:%lld\n", res, (long long int)all, PT_LU_USEC(timer)); srand(time(NULL)); TIMER_RESET(timer); all = 0; for(i = 0; i < 1000; i++) { from = 1356969600 + (rand()%31536000); to = from + rand()%31536000; all += lkv_range(lkv, from, to, NULL); } TIMER_SAMPLE(timer); fprintf(stdout, "range(null) 1000 times total:%lld, time used:%lld\n", (long long int)all, PT_LU_USEC(timer)); #endif lkv_close(lkv); TIMER_CLEAN(timer); free(res); } }
//gcc -o dmap dmap.c -DDMAP_TEST -DTEST_INS -DHAVE_PTHREAD -lpthread && ./dmap int main() { DMAP *dmap = NULL; int i = 0, j = 0, n = 0, total = 0, no = 0, stat[MASK], stat2[MASK]; double val = 0, from = 0, to = 0, *res = NULL; double inputs[256], nos[256], last[256]; double all = 0; time_t stime = 0, etime = 0; void *timer = NULL; if((dmap = dmap_init("/tmp/1.idx"))) { res = (double *)calloc(60000000, sizeof(double)); TIMER_INIT(timer); #ifdef TEST_INS //fprintf(stdout, "sizeof(stat):%d\n", sizeof(stat)); memset(stat, 0, sizeof(stat)); memset(stat2, 0, sizeof(stat2)); srand(time(NULL)); n = 256; for(i = 0; i < n; i++) { no = (rand()%MASK); nos[i] = no; if((i % 3) == 0) inputs[i] = no * -1; else inputs[i] = no; } TIMER_RESET(timer); for(i = 1; i < 20000000; i++) { j = (rand()%n); val = inputs[j]; no = nos[j]; stat[no]++; dmap_set(dmap, i, val); last[j] = i; } TIMER_SAMPLE(timer); fprintf(stdout, "set() 40000000 data, time used:%lld\n", PT_LU_USEC(timer)); TIMER_RESET(timer); for(i = 0; i < n; i++) { dmap_del(dmap, last[i]); } TIMER_SAMPLE(timer); fprintf(stdout, "del() time used:%lld\n", PT_LU_USEC(timer)); TIMER_RESET(timer); for(i = 0; i < n; i++) { val = inputs[i]; no = nos[i]; stat2[no] = dmap_in(dmap, val, res); } TIMER_SAMPLE(timer); fprintf(stdout, "in() time used:%lld\n", PT_LU_USEC(timer)); TIMER_RESET(timer); total = dmap_ins(dmap, inputs, n, NULL); TIMER_SAMPLE(timer); fprintf(stdout, "ins(keys, NULL) total:%d time used:%lld\n", total, PT_LU_USEC(timer)); TIMER_RESET(timer); total = dmap_ins(dmap, inputs, n, res); TIMER_SAMPLE(timer); fprintf(stdout, "ins(keys, res:%p) total:%d time used:%lld\n", res, total, PT_LU_USEC(timer)); for(i = 0; i < n; i++) { j = nos[i]; if(stat[j] != stat2[j]) fprintf(stdout, "%d:%d/%d::%d\n", j, stat[j], stat2[j], inputs[i]); } #ifdef OUT_ALL for(i = 0; i < total; i++) { fprintf(stdout, "%d:%d\n", i, res[i]); } #endif #endif /* for(i = 0; i < dmap->state->count; i++) { fprintf(stdout, "%d:{min:%d max:%d}(%d)\n", i, dmap->slots[i].min, dmap->slots[i].max, dmap->slots[i].count); } */ #ifdef TEST_RANGEFILTER dmap_set(dmap, 1, 1234567); dmap_set(dmap, 2, 1567890); fprintf(stdout, "rangefrom():%d\n", dmap_rangefrom(dmap, 1569000, NULL)); fprintf(stdout, "rangeto():%d\n", dmap_rangeto(dmap, 1111111, NULL)); fprintf(stdout, "range():%d\n", dmap_range(dmap, 1111111, 1600000, NULL)); #endif #ifdef TEST_RANGE srand(time(NULL)); TIMER_RESET(timer); for(i = 1; i < 40000000; i++) { val = 1356969600 + (rand()%31536000); dmap_set(dmap, i, val); } TIMER_SAMPLE(timer); fprintf(stdout, "set() 40000000 timestamps, time used:%lld\n", PT_LU_USEC(timer)); fflush(stdout); srand(time(NULL)); TIMER_RESET(timer); all = 0; for(i = 0; i < 1000; i++) { val = 1356969600 + (rand()%31536000); all += dmap_rangefrom(dmap, val, res); } TIMER_SAMPLE(timer); fprintf(stdout, "rangefrom() 1000 times total:%lld, time used:%lld\n", (long long int)all, PT_LU_USEC(timer)); fflush(stdout); srand(time(NULL)); TIMER_RESET(timer); all = 0; for(i = 0; i < 1000; i++) { val = 1356969600 + (rand()%31536000); all += dmap_rangeto(dmap, val, res); } TIMER_SAMPLE(timer); fprintf(stdout, "rangeto() 1000 times total:%lld, time used:%lld\n", (long long int)all, PT_LU_USEC(timer)); fflush(stdout); srand(time(NULL)); TIMER_RESET(timer); all = 0; for(i = 0; i < 1000; i++) { from = 1356969600 + (rand()%31536000); to = from + rand()%31536000; all += dmap_range(dmap, from, to, res); } TIMER_SAMPLE(timer); fprintf(stdout, "range(%p) 1000 times total:%lld, time used:%lld\n", res, (long long int)all, PT_LU_USEC(timer)); fflush(stdout); srand(time(NULL)); TIMER_RESET(timer); all = 0; for(i = 0; i < 1000; i++) { from = 1356969600 + (rand()%31536000); to = from + rand()%31536000; all += dmap_range(dmap, from, to, NULL); } TIMER_SAMPLE(timer); fprintf(stdout, "range(null) 1000 times total:%lld, time used:%lld\n", (long long int)all, PT_LU_USEC(timer)); fflush(stdout); #endif dmap_close(dmap); TIMER_CLEAN(timer); free(res); } }
/**************************************************************************** * Function: main * * Description: 6228 hardware monitor usage. * * Inputs: none * Return: none ****************************************************************************/ int main () { P6228_REG_ADDR p6228Regs; /* 6228 registers */ ADM1024_PARAMS tempSensor; /* temp. sensor params */ ADM1024_VALUES tempValues; /* temp. sensor values */ int procId; unsigned int status1; unsigned int status2; int temp; int temperature; float voltage; int error; TIMER_RESET(0); /* Turn off timer 0 */ INTR_GLOBAL_DISABLE(); /* disable global interrupts */ CACHE_DISABLE(); /* disable cache */ P4290_LED0_OFF; /* error indicator */ P4290_LED1_OFF; /* DDR bypass indicator */ P4290_LED2_OFF; /* DDR selected indicator */ P4290_LED3_OFF; /* activity indicator */ /* Get the processor id on which the program running */ procId = P4290GetProcId(); /* Confirm the proper processor is running */ if ((procId != P4290_PROC_A) && (procId != P4290_PROC_C)) { /* Only processor A or C can run this example */ P4290_LED0_ON; while(1) ; } /* Initialize table of 6228 register addresses */ P6228InitRegAddr(P6228_CTRL_BASE, &p6228Regs); /* Get module id */ if ((VIMGetModuleId(p6228Regs.eepromID)) != P6228_MODULE_ID) { /* Not a 6228 module. */ P4290_LED0_ON; while(1) ; } /* Set 6228 registers to a default, known state */ P6228ResetRegs(&p6228Regs); /* Load temperature sensor parameter table with default values. */ P6228SetHwMonitorDefaults (&tempSensor); /* Temperature Sensor Parameters - there are 21 parameters in the data * structure, one to set the mode, two for interrupt masks and 18 limit * parameters. There are two limit parameters for each condition that * is monitored for the 6228, a low limit and a high limit. * * For this program, all monitored conditions are read back. All limits * below are the same as default values. */ /* internal temperature sensor */ tempSensor.intTempHighLimit = 85; tempSensor.intTempLowLimit = 0; /* External temperature 1 (FPGA) */ tempSensor.extTemp1HighLimit = 85; tempSensor.extTemp1LowLimit = 0; /* External temperature 2 (board temp) */ tempSensor.extTemp2HighLimit = 85; tempSensor.extTemp2LowLimit = 0; /* 5 Volt monitor */ tempSensor.v5HighLimit = 5.50; tempSensor.v5LowLimit = 4.50; /* Vcc monitor (3.3 Volts) */ tempSensor.vccHighLimit = 3.63; tempSensor.vccLowLimit = 2.97; /* 1.5 Volt monitor (Analog Input 1) */ tempSensor.ain1HighLimit = 1.65; tempSensor.ain1LowLimit = 1.35; /* 1.8 Volt monitor (Analog Input 2) */ tempSensor.ain2HighLimit = 1.98; tempSensor.ain2LowLimit = 1.62; /* 2.5 Volt monitor (Vccp1) */ tempSensor.vccp1HighLimit = 2.75; tempSensor.vccp1LowLimit = 2.25; /* 12 Volt monitor */ tempSensor.v12HighLimit = 13.2; tempSensor.v12LowLimit = 10.8; /* Initialize the hardware monitor */ P6228InitHwMonitor(&tempSensor, p6228Regs.hwMonitorPort); /* Delay for the ADM1024 to get settled before reading status */ BaseboardDelayuS(25000); /* Main Loop ----------------------------------------------------------- * * The main loop reads back the two status registers from the ADM1024. * When errors are found, the specific value is read back and tested * against the limits. If a value is below the lower limit, a bit is * set in the lower 16 bits of the variable "error". The upper 16 bits * are used for values above the upper limit. Separate bits are used * for each monitored value. "Error" can be viewed under Code Composer * to identify any failed values. */ while (1) { error = 0; /* read the two interrupt status registers */ status1 = I2CTempSensorRead (p6228Regs.hwMonitorPort, P6228_TEMP_SENSOR_CHIP, ADM1024_INTR_STAT1_REG); status2 = I2CTempSensorRead (p6228Regs.hwMonitorPort, P6228_TEMP_SENSOR_CHIP, ADM1024_INTR_STAT2_REG); /* Check the status for each monitored condition. If the status * bit indicated a limit was exceeded, determine if it was the low * or high limit. */ /* internal temperature */ if (status1 & ADM1024_INTR_STAT1_INT_TEMP_MASK) { /* read value and set error code */ temperature = I2CTempSensorRead (p6228Regs.hwMonitorPort, P6228_TEMP_SENSOR_CHIP, ADM1024_INT_TEMP_VAL_REG); temperature = (temperature << 24) >> 24; /* sign adjust */ if (temperature < tempSensor.intTempLowLimit) error |= 0x00000001; /* below low limit */ else error |= 0x00010000; /* above high limit */ } /* external temperature - FPGA 1 */ if (status1 & ADM1024_INTR_STAT1_EXT_TEMP1_MASK) { /* read value and set error code */ temperature = I2CTempSensorRead (p6228Regs.hwMonitorPort, P6228_TEMP_SENSOR_CHIP, ADM1024_EXT_TEMP1_VAL_REG); temperature = (temperature << 24) >> 24; /* sign adjust */ if (temperature < tempSensor.extTemp1LowLimit) error |= 0x00000002; /* below low limit */ else error |= 0x00020000; /* above high limit */ }