@Override public void run() { if (!isActivityThread()) { runOnActivityThread(this); } else { this.wwd.getFrameMetrics().reset(); } } }
protected boolean printMetrics() { // Assemble the current system memory info. ActivityManager am = (ActivityManager) this.getSystemService(Context.ACTIVITY_SERVICE); ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); am.getMemoryInfo(mi); // Assemble the current WorldWind frame metrics. FrameMetrics fm = this.getWorldWindow().getFrameMetrics(); // Print a log message with the system memory, WorldWind cache usage, and WorldWind average frame time. Logger.log(Logger.INFO, String.format(Locale.US, "System memory %,.0f KB Heap memory %,.0f KB Render cache %,.0f KB Frame time %.1f ms + %.1f ms", (mi.totalMem - mi.availMem) / 1024.0, (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024.0, fm.getRenderResourceCacheUsedCapacity() / 1024.0, fm.getRenderTimeAverage(), fm.getDrawTimeAverage())); // Reset the accumulated WorldWind frame metrics. fm.reset(); // Print the frame metrics again after the configured delay. return this.handler.sendEmptyMessageDelayed(PRINT_METRICS, PRINT_METRICS_DELAY); }
@Override public void run() { if (!isActivityThread()) { runOnActivityThread(this); } else { Logger.log(Logger.INFO, this.wwd.getFrameMetrics().toString()); } } }
protected boolean printMetrics() { WorldWindow wwd = this.getWorldWindow(); if (wwd == null) { return false; } // Assemble the current system memory info. ActivityManager am = (ActivityManager) this.getSystemService(Context.ACTIVITY_SERVICE); ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo(); am.getMemoryInfo(mi); // Assemble the current WorldWind frame metrics. FrameMetrics fm = this.getWorldWindow().getFrameMetrics(); // Print a log message with the system memory, WorldWind cache usage, and WorldWind average frame time. Logger.log(Logger.INFO, String.format(Locale.US, "System memory %,.0f KB Heap memory %,.0f KB Render cache %,.0f KB Frame time %.1f ms + %.1f ms", (mi.totalMem - mi.availMem) / 1024.0, (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024.0, fm.getRenderResourceCacheUsedCapacity() / 1024.0, fm.getRenderTimeAverage(), fm.getDrawTimeAverage())); // Reset the accumulated WorldWind frame metrics. fm.reset(); // Print the frame metrics again after the configured delay. return this.handler.sendEmptyMessageDelayed(PRINT_METRICS, PRINT_METRICS_DELAY); }