bool FailOverCacheAsyncBridge::addEntries(const std::vector<ClusterLocation>& locs, size_t num_locs, uint64_t start_address, const uint8_t* data) { VERIFY(num_locs <= max_entries()); LOCK_NEW_ONES(); // Needs improvement!!! if (stop_) { return true; } TODO("AR: revisit the batching of entries"); // TODO: Batches must not cross SCO boundaries. // We could be way smarter by allowing multiple outstanding batches. const bool new_sco = (not newOnes.empty()) and (not locs.empty()) and (newOnes.back().cli_.sco() != locs.front().sco()); setThrottling((newOnes.size() + num_locs > max_entries()) or new_sco); if (not throttling) { // Otherwise work the batch for (size_t i = 0; i < num_locs; ++i) { addEntry(locs[i], start_address + i * cluster_multiplier_, data + i * cluster_size_(), cluster_size_()); } } maybe_swap_(new_sco); return not throttling; }
int acpithr_handle_offline(SConfig *config) { if (throttling_level != config->thrOffline) { syslog(LOG_NOTICE, "AC offline"); if (setThrottling(config->thrOffline) == 0) { syslog(LOG_ERR, "can't set throttling level, terminating"); return -1; } throttling_level = config->thrOffline; if (config->verbosityLevel >= 1) syslog(LOG_INFO, "processor has %d KHz, and temperature %d", getProcessorKHz(), getTemperature()); } return 0; }
int acpithr_handle_online(SConfig *config, unsigned int temp) { float value; unsigned int tmp; if (temp < config->tempLow) { if (throttling_level != 0) { syslog(LOG_NOTICE, "processor temperature below %d -> setting throttling to 0", temp); if (setThrottling(0) == 0) { syslog(LOG_ERR, "can't set throttling, terminating"); return -1; } throttling_level = 0; if (config->verbosityLevel >= 1) syslog(LOG_INFO, "processor has %d KHz, and temperature %d", getProcessorKHz(), getTemperature()); } return 0; } if (temp > config->tempHigh) { if (throttling_level != config->thrStates - 1) { syslog(LOG_NOTICE, "processor temperature %d exceeded maximum -> setting throttling to %d", temp, config->thrStates - 1); if (setThrottling(config->thrStates - 1) == 0) { syslog(LOG_ERR, "can't set throttling, terminating"); return -1; } throttling_level = config->thrStates - 1; if (config->verbosityLevel >= 1) syslog(LOG_INFO, "processor has %d KHz, and temperature %d", getProcessorKHz(), getTemperature()); } return 0; } /* temp is between Low and High -> interpolate */ value = (float)(config->thrStates - 2) / (float)(config->tempHigh - config->tempLow); tmp = (unsigned int)((float)(temp - config->tempLow) * value); if (tmp != throttling_level) { syslog(LOG_NOTICE, "processor temperature %d mapped to %u throttling level", temp, tmp); if (setThrottling(tmp) == 0) { syslog(LOG_ERR, "can't set throttling, terminating"); return -1; } throttling_level = tmp; if (config->verbosityLevel >= 1) syslog(LOG_INFO, "processor has %d KHz, and temperature %d", getProcessorKHz(), getTemperature()); } return 0; }