TEST(ConfigTest, shouldSelectBestDensityWhenNoneSpecified) {
    ResTable_config deviceConfig;
    memset(&deviceConfig, 0, sizeof(deviceConfig));
    deviceConfig.sdkVersion = 21;

    Vector<ResTable_config> configs;
    configs.add(buildDensityConfig(ResTable_config::DENSITY_HIGH));

    ResTable_config expectedBest = buildDensityConfig(ResTable_config::DENSITY_MEDIUM);
    configs.add(expectedBest);
    ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));

    expectedBest = buildDensityConfig(ResTable_config::DENSITY_ANY);
    configs.add(expectedBest);
    ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));
}
TEST(ConfigTest, shouldSelectBestDensity) {
  ResTable_config deviceConfig;
  memset(&deviceConfig, 0, sizeof(deviceConfig));
  deviceConfig.density = ResTable_config::DENSITY_XHIGH;
  deviceConfig.sdkVersion = 21;

  Vector<ResTable_config> configs;

  ResTable_config expectedBest =
      buildDensityConfig(ResTable_config::DENSITY_HIGH);
  configs.add(expectedBest);
  ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));

  expectedBest = buildDensityConfig(ResTable_config::DENSITY_XXHIGH);
  configs.add(expectedBest);
  ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));

  expectedBest = buildDensityConfig(int(ResTable_config::DENSITY_XXHIGH) - 20);
  configs.add(expectedBest);
  ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));

  configs.add(buildDensityConfig(int(ResTable_config::DENSITY_HIGH) + 20));
  ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));

  expectedBest = buildDensityConfig(ResTable_config::DENSITY_XHIGH);
  configs.add(expectedBest);
  ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));

  expectedBest = buildDensityConfig(ResTable_config::DENSITY_ANY);
  expectedBest.sdkVersion = 21;
  configs.add(expectedBest);
  ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));
}
Example #3
0
void NetInfo::calculateStats(unsigned int timeToDiscard, unsigned int analyzerSleepTime) {
    adquireLock(this);
    this->maxPackets = timeToDiscard*SECtoMICROSEC/interval;
    
    if (not beacons.empty()) {
        if ((lastDelay != 0 or timeOK < timeToDiscard) and bestIndex >= 0) {
            numPackets = beacons.size();
            if (not calculateStats(false) and lastDelay < 0.8) timeOK = 0;
            else if (timeOK < timeToDiscard) timeOK += analyzerSleepTime;
        }
        removeOldBeacons(timeToDiscard);
        selectBest();
        calculateStats(true);
        statsTimestamp = time(NULL);
        ok = timeOK >= timeToDiscard;
    }
    
    releaseLock(this);
}
Example #4
0
void MultiScale::portSizeReceiveChanged() {
    inport_.requestSize(selectBest());
}
Example #5
0
void MultiScale::initialize() throw (tgt::Exception) {
    ScalingProcessor::initialize();
    inport_.requestSize(selectBest());
}