void pcm_print_counter_stats(system_counter_state_t before_sstate, system_counter_state_t after_sstate) { std::cout << "Instructions per clock: " << getIPC(before_sstate, after_sstate) << std::endl << "L2 cache hit ratio: " << getL2CacheHitRatio(before_sstate, after_sstate) << std::endl << "L3 cache hit ratio: " << getL3CacheHitRatio(before_sstate, after_sstate) << std::endl << "L2 cache misses: " << getL2CacheMisses(before_sstate, after_sstate) << std::endl << "L3 cache misses: " << getL3CacheMisses(before_sstate, after_sstate) << std::endl << "Cycles lost due to L2 cache misses: " << getCyclesLostDueL2CacheMisses(before_sstate, after_sstate) << std::endl << "Cycles lost due to L3 cache misses: " << getCyclesLostDueL3CacheMisses(before_sstate, after_sstate) << std::endl << "Bytes read: " << getBytesReadFromMC(before_sstate, after_sstate) << std::endl; }
void Puerta::run(){ getIPC(); Mensaje m; while(true){ m = recibirPersona(); if (m.entra){ ponerPersona(m.idPersona); }else{ sacarPersona(m.idPersona); } } }
void SoundEngine::timerCallback() { /* * Perform per-buffer state updates, then fill the next frame * (1/2 of 'buffer') with audio samples. */ uint8_t *bufPtr = buffer + bufferIndex; bufferIndex ^= SAMPLES_PER_FRAME; if (streaming) { /* * We're in the middle of an audio stream. Generate samples * based on the values in our FIFO, which are timestamps at * which a PC speaker edge transition (0->1 or 1->0) occurred. */ int remaining; for (remaining = SAMPLES_PER_FRAME; remaining; remaining--, bufPtr++) { uint16_t head = getIPC()->head; uint16_t tail = getIPC()->tail; if (head == tail) { /* * Stream ended. Fill the rest of the buffer with silence. */ streaming = false; memset(bufPtr, edgeState, remaining); break; } /* * Slurp up any events from the timestamp buffer which have * elapsed by now, and adjust the current speaker state * accordingly. */ while (head != tail && ((int32_t)(getIPC()->fifo[tail] - currentTime)) <= 0) { edgeState ^= 0x80; getIPC()->tail = tail = (tail + 1) & (FIFO_SIZE - 1); head = getIPC()->head; } currentTime += CLOCKS_PER_SAMPLE; *bufPtr = edgeState; } } else { /* * No stream is currently in progress. Output silence. If we * see data in the FIFO, start a stream on the _next_ timer * tick, to give the FIFO some opportunity to pre-buffer. */ if (getIPC()->head != getIPC()->tail) { currentTime = getIPC()->fifo[getIPC()->tail]; streaming = true; } memset(bufPtr, edgeState, SAMPLES_PER_FRAME); } }