@Override protected void onBindInformation() { StatsSnapshot info = Picasso.with(getContext()) .getSnapshot(); setSubHeading("Cache", String.format("%s / %s (%f percent)", humanReadableByteCount(info.size, true), humanReadableByteCount(info.maxSize, true), ((info.size * 100f) / info.maxSize))); setValue("\tHits", String.valueOf(info.cacheHits)); setValue("\tMisses", String.valueOf(info.cacheMisses)); setSubHeading("Decoded", String.valueOf(info.downloadCount)); setValue("\tTotal", humanReadableByteCount(info.totalDownloadSize, true)); setValue("\tAverage", humanReadableByteCount(info.averageDownloadSize, true)); setSubHeading("Transformed", String.valueOf(info.transformedBitmapCount)); setValue("\tTotal", humanReadableByteCount(info.totalTransformedBitmapSize, true)); setValue("\tAverage", humanReadableByteCount(info.averageTransformedBitmapSize, true)); }
private void refreshPicassoStats() { StatsSnapshot snapshot = picasso.getSnapshot(); String size = getSizeString(snapshot.size); String total = getSizeString(snapshot.maxSize); int percentage = (int) ((1f * snapshot.size / snapshot.maxSize) * 100); picassoCacheSizeView.setText(size + " / " + total + " (" + percentage + "%)"); picassoCacheHitView.setText(String.valueOf(snapshot.cacheHits)); picassoCacheMissView.setText(String.valueOf(snapshot.cacheMisses)); picassoDecodedView.setText(String.valueOf(snapshot.originalBitmapCount)); picassoDecodedTotalView.setText(getSizeString(snapshot.totalOriginalBitmapSize)); picassoDecodedAvgView.setText(getSizeString(snapshot.averageOriginalBitmapSize)); picassoTransformedView.setText(String.valueOf(snapshot.transformedBitmapCount)); picassoTransformedTotalView.setText(getSizeString(snapshot.totalTransformedBitmapSize)); picassoTransformedAvgView.setText(getSizeString(snapshot.averageTransformedBitmapSize)); }
/** * overarching stats of all Picasso requests */ private void printPicassoStatsSnapshot() { StatsSnapshot picassoStats = Picasso.with(context).getSnapshot(); // you could set the debugger here to analyze the picassoStats object // or print the stats to Android Logcat Log.d("Picasso Stats", picassoStats.toString()); }
private void refresh() { final StatsSnapshot snapshot = picasso.getSnapshot(); final String size = getSizeString(snapshot.size); final String total = getSizeString(snapshot.maxSize); final int percentage = (int) ((1f * snapshot.size / snapshot.maxSize) * 100); cacheLabel.setText(size + " / " + total + " (" + percentage + "%)"); cacheHitsLabel.setText(String.valueOf(snapshot.cacheHits)); cacheMissesLabel.setText(String.valueOf(snapshot.cacheMisses)); decodedLabel.setText(String.valueOf(snapshot.originalBitmapCount)); decodedTotalLabel.setText(getSizeString(snapshot.totalOriginalBitmapSize)); decodedAverageLabel.setText(getSizeString(snapshot.averageOriginalBitmapSize)); transformedLabel.setText(String.valueOf(snapshot.transformedBitmapCount)); transformedTotalLabel.setText(getSizeString(snapshot.totalTransformedBitmapSize)); transformedAverageLabel.setText(getSizeString(snapshot.averageTransformedBitmapSize)); }