use of com.att.aro.core.bestpractice.pojo.UsingCacheResult in project VideoOptimzer by attdevsupport.
the class ARODiagnosticsOverviewRouteImpl method routeHyperlink.
@Override
public void routeHyperlink(BestPracticeType bpType) {
if (bpType.equals(BestPracticeType.DUPLICATE_CONTENT)) {
jtabbedPane.setSelectedIndex(OVERVIEW_INDEX);
} else {
jtabbedPane.setSelectedIndex(DIAGNOSTIC_INDEX);
DiagnosticsTab diagnosticsTab = (DiagnosticsTab) jtabbedPane.getSelectedComponent();
switch(bpType) {
case FILE_COMPRESSION:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof FileCompressionResult) {
// diagnosticsTab.setHighlightedTCP(((FileCompressionResult)result).getConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
// break;
case USING_CACHE:
{
// done
for (AbstractBestPracticeResult result : diagnosticsTab.getAnalyzerResult().getBestPracticeResults()) {
if (result instanceof UsingCacheResult) {
diagnosticsTab.setHighlightedTCP(((UsingCacheResult) result).getNoCacheHeaderFirstPacket().getTimeStamp());
break;
}
}
}
break;
case CACHE_CONTROL:
{
// cant not find cache control start time in
// CacheControlResult
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof CacheControlResult) {
// diagnosticsTab.setHighlightedTCP(((CacheControlResult)result).getConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
case COMBINE_CS_JSS:
{
// done
for (AbstractBestPracticeResult result : diagnosticsTab.getAnalyzerResult().getBestPracticeResults()) {
if (result instanceof CombineCsJssResult) {
diagnosticsTab.setHighlightedTCP(((CombineCsJssResult) result).getConsecutiveCssJsFirstPacket().getTimeStamp());
break;
}
}
}
break;
case IMAGE_SIZE:
{
}
break;
case IMAGE_MDATA:
{
}
break;
case IMAGE_CMPRS:
{
}
break;
case IMAGE_FORMAT:
{
}
break;
case IMAGE_COMPARE:
{
}
break;
case MINIFICATION:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof CombineCsJssResult) {
// diagnosticsTab.setHighlightedTCP(((MinificationResult)result).getConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
case SPRITEIMAGE:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof SpriteImageResult) {
// diagnosticsTab.setHighlightedTCP(((SpriteImageResult)result).getConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
case UNNECESSARY_CONNECTIONS:
{
// to test
for (AbstractBestPracticeResult result : diagnosticsTab.getAnalyzerResult().getBestPracticeResults()) {
if (result instanceof UnnecessaryConnectionResult) {
diagnosticsTab.setHighlightedTCP(((UnnecessaryConnectionResult) result).getTightlyCoupledBurstTime());
break;
}
}
}
break;
case SCRIPTS_URL:
{
// done
for (AbstractBestPracticeResult result : diagnosticsTab.getAnalyzerResult().getBestPracticeResults()) {
if (result instanceof ScriptsResult) {
diagnosticsTab.setHighlightedTCP(((ScriptsResult) result).getFirstFailedHtml());
break;
}
}
}
break;
case SCREEN_ROTATION:
{
}
break;
case SIMUL_CONN:
{
}
break;
case MULTI_SIMULCONN:
{
}
break;
case PERIODIC_TRANSFER:
{
// done
for (AbstractBestPracticeResult result : diagnosticsTab.getAnalyzerResult().getBestPracticeResults()) {
if (result instanceof PeriodicTransferResult) {
diagnosticsTab.setHighlightedTCP(((PeriodicTransferResult) result).getMinimumPeriodicRepeatTime());
break;
}
}
}
break;
case HTTP_4XX_5XX:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof Http4xx5xxResult) {
// diagnosticsTab.setHighlightedTCP(((Http4xx5xxResult)result).getHttpResCodelist()ConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
case HTTP_3XX_CODE:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof Http3xxCodeResult) {
// diagnosticsTab.setHighlightedTCP(((Http3xxCodeResult)result).getFirstResMap()ConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
case HTTP_1_0_USAGE:
{
// done
for (AbstractBestPracticeResult result : diagnosticsTab.getAnalyzerResult().getBestPracticeResults()) {
if (result instanceof Http10UsageResult) {
diagnosticsTab.setHighlightedTCP(((Http10UsageResult) result).getHttp10Session());
break;
}
}
}
break;
case FILE_ORDER:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof FileOrderResult) {
// diagnosticsTab.setHighlightedTCP(((FileOrderResult)result).getConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
case EMPTY_URL:
{
// done
for (AbstractBestPracticeResult result : diagnosticsTab.getAnalyzerResult().getBestPracticeResults()) {
if (result instanceof EmptyUrlResult) {
diagnosticsTab.setHighlightedTCP(((EmptyUrlResult) result).getFirstFailedHtml());
break;
}
}
}
break;
case DISPLAY_NONE_IN_CSS:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof DisplayNoneInCSSResult) {
// diagnosticsTab.setHighlightedTCP(((DisplayNoneInCSSResult)result).getConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
case CONNECTION_OPENING:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof ConnectionOpeningResult) {
// diagnosticsTab.setHighlightedTCP(((ConnectionOpeningResult)result).getConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
case CONNECTION_CLOSING:
{
// done
for (AbstractBestPracticeResult result : diagnosticsTab.getAnalyzerResult().getBestPracticeResults()) {
if (result instanceof ConnectionClosingResult) {
diagnosticsTab.setHighlightedTCP(((ConnectionClosingResult) result).getLargestEnergyTime());
break;
}
}
}
break;
case ASYNC_CHECK:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof AsyncCheckInScriptResult) {
// diagnosticsTab.setHighlightedTCP(((AsyncCheckInScriptResult)result).getConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
case ACCESSING_PERIPHERALS:
{
// for (AbstractBestPracticeResult result :
// diagnosticsTab.getAnalyzerResult().getBestPracticeResults())
// {
// if (result instanceof AccessingPeripheralResult) {
// diagnosticsTab.setHighlightedTCP(((AccessingPeripheralResult)result).getConsecutiveCssJsFirstPacket().getTimeStamp());
// break;
// }
// }
}
break;
default:
break;
}
// switch
}
}
use of com.att.aro.core.bestpractice.pojo.UsingCacheResult in project VideoOptimzer by attdevsupport.
the class UsingCacheImpl method runTest.
@Override
public AbstractBestPracticeResult runTest(PacketAnalyzerResult tracedata) {
UsingCacheResult result = new UsingCacheResult();
if (tracedata.getCacheAnalysis() == null) {
return null;
}
double cacheHeaderRatio = 0.0;
boolean usingCache = false;
int validCount = 0;
int noCacheHeadersCount = 0;
PacketInfo noCacheHeaderFirstPacket = null;
for (CacheEntry entry : tracedata.getCacheAnalysis().getDiagnosisResults()) {
if (entry.getDiagnosis() != Diagnosis.CACHING_DIAG_REQUEST_NOT_FOUND && entry.getDiagnosis() != Diagnosis.CACHING_DIAG_INVALID_OBJ_NAME && entry.getDiagnosis() != Diagnosis.CACHING_DIAG_INVALID_REQUEST && entry.getDiagnosis() != Diagnosis.CACHING_DIAG_INVALID_RESPONSE) {
++validCount;
if (!entry.hasCacheHeaders()) {
if (noCacheHeadersCount == 0) {
noCacheHeaderFirstPacket = entry.getSessionFirstPacket();
}
++noCacheHeadersCount;
}
}
}
cacheHeaderRatio = validCount > 0 ? (100.0 * noCacheHeadersCount) / validCount : 0.0;
usingCache = cacheHeaderRatio <= 10.0;
if (usingCache) {
result.setResultType(BPResultType.PASS);
result.setResultText(textResultPass);
result.setResultExcelText(BPResultType.PASS.getDescription());
} else {
// ref. old analyzer give warning in this best practice
result.setResultType(BPResultType.WARNING);
String text = MessageFormat.format(textResults, ApplicationConfig.getInstance().getAppShortName(), NumberFormat.getIntegerInstance().format(cacheHeaderRatio));
result.setResultText(text);
result.setResultExcelText(MessageFormat.format(textExcelResults, BPResultType.WARNING.getDescription(), NumberFormat.getIntegerInstance().format(cacheHeaderRatio)));
}
result.setCacheHeaderRatio(cacheHeaderRatio);
result.setNoCacheHeaderFirstPacket(noCacheHeaderFirstPacket);
result.setAboutText(aboutText);
result.setDetailTitle(detailTitle);
result.setLearnMoreUrl(learnMoreUrl);
result.setOverviewTitle(overviewTitle);
result.setExportAllCacheConPct(exportAllCacheConPct);
return result;
}
use of com.att.aro.core.bestpractice.pojo.UsingCacheResult in project VideoOptimzer by attdevsupport.
the class ApplicationScoreDerived method processDerivedAttributes.
private void processDerivedAttributes(AROTraceData model, ApplicationSampling applicationSampling) {
int topScore = 100;
PacketAnalyzerResult analyzerResults = model.getAnalyzerResult();
List<AbstractBestPracticeResult> bpResults = model.getBestPracticeResults();
List<BurstAnalysisInfo> burstInfo = analyzerResults.getBurstCollectionAnalysisData().getBurstAnalysisInfo();
AbstractRrcStateMachine rrcStateMachine = analyzerResults.getStatemachine();
Statistic statistics = analyzerResults.getStatistic();
int burstInfoSize = burstInfo.size();
// TODO: CONNECTION_CLOSING and USING_CACHE enum types are reversed in model. FIX!
for (AbstractBestPracticeResult result : bpResults) {
if (result instanceof UsingCacheResult) {
UsingCacheResult bpuscaResult = (UsingCacheResult) result;
bpuscaResult.getCacheHeaderRatio();
cacheHeaderControlScore = (int) ((isUsingCache(bpuscaResult) ? topScore : getIndividualScore(bpuscaResult.getCacheHeaderRatio(), 10, 25, 65)) * .75);
} else if (result instanceof ConnectionClosingResult) {
ConnectionClosingResult bpcoclResult = (ConnectionClosingResult) result;
connectionClosingScore = (int) ((bpcoclResult.isConClosingProb() ? topScore : getIndividualScore(bpcoclResult.getTcpControlEnergyRatio() * 100, 5, 20, 50)) * .75);
} else if (result instanceof UnnecessaryConnectionResult) {
UnnecessaryConnectionResult bpunco = (UnnecessaryConnectionResult) result;
bpunco.getTightlyCoupledBurstCount();
int tightlyGroupedBursts = (int) (burstInfoSize > 0 ? 100.0 * bpunco.getTightlyCoupledBurstCount() / burstInfoSize : 0.0);
tightlyGroupedConnectionScore = (int) (tightlyGroupedBursts * 1.50);
} else if (result instanceof PeriodicTransferResult) {
PeriodicTransferResult periodicTransferResult = (PeriodicTransferResult) result;
periodicTransferScore = (int) ((isPeriodicCount(periodicTransferResult) ? topScore : getPeriodicTransferScoreCalculation(periodicTransferResult, burstInfo)) * 1.50);
} else if (result instanceof CacheControlResult) {
CacheControlResult cacheControlResultResult = (CacheControlResult) result;
connectionExpirationScore = (int) ((isCacheControl(cacheControlResultResult) ? topScore : getConnectionExpirationScoreCalculation(cacheControlResultResult)) * .50);
} else if (result instanceof DuplicateContentResult) {
DuplicateContentResult duplicateContentResult = (DuplicateContentResult) result;
duplicateContentScore = (int) ((isDuplicateContent(duplicateContentResult) ? topScore : getDuplicateContentScoreCalculation(duplicateContentResult)) * 1.25);
}
}
double promotionRatio;
double joulesPerKilobyte;
switch(rrcStateMachine.getType()) {
case LTE:
promotionRatio = ((RrcStateMachineLTE) rrcStateMachine).getCRPromotionRatio();
joulesPerKilobyte = ((RrcStateMachineLTE) rrcStateMachine).getJoulesPerKilobyte();
break;
case Type3G:
promotionRatio = ((RrcStateMachine3G) rrcStateMachine).getPromotionRatio();
joulesPerKilobyte = ((RrcStateMachine3G) rrcStateMachine).getJoulesPerKilobyte();
break;
case WiFi:
promotionRatio = 0.0;
joulesPerKilobyte = 0.0;
break;
default:
throw new AROUIPanelException("Undhandled state machine type " + rrcStateMachine.getType().name());
}
signalingOverheadScore = (int) (applicationSampling.getPromoRatioPercentile(promotionRatio) * 1.25);
averageRateScore = (int) (applicationSampling.getThroughputPercentile(statistics.getAverageKbps()) * .625);
energyEfficiencyScore = (int) (ApplicationSampling.getInstance().getJpkbPercentile(joulesPerKilobyte) * 1.875);
}
Aggregations