GithubHelp home page GithubHelp logo

hehonghui / tinydancer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from friendlyrobotnyc/tinydancer

0.0 2.0 1.0 6.91 MB

An android library for displaying fps from the choreographer and percentage of time with two or more frames dropped. Android 性能检测开源库

License: MIT License

Java 100.00%

tinydancer's Introduction

Tiny Dancer Build Status

A real time frames per second measuring library for Android that also shows a color coded metric. This metric is based on percentage of time spent when you have dropped 2 or more frames. If the application spends more than 5% in this state then the color turns yellow, when you have reached the 20% threshold the indicator turns red.

相关修改

  • 在原版TinyDancer的基础上修复一些crash bug
  • 重构代码, 使逻辑更清晰
  • 收集最原始的FPS数据,以及去除对ui展示的依赖
  • 支持将fps数据dump到本地文件中,使之能够跟跟自动化测试对接上
  • 支持 Activity页面的自动检测 (在Application中调用 TinyDancer.install(this) ) 即可

Min SDK

Tiny Dancer min sdk is API 16

Getting started

In your DebugApplication class:

public class DebugApplication extends Application {

  @Override public void onCreate() {

   // 自动收集每个 Activity的 fps 数据, 并且dump到本地文件中
   TinyDancer.install(this);

  // 创建 TinyDancer
   TinyDancer.create(this)
             .show();
             
   //alternatively
   TinyDancer.create(this)
      .redFlagPercentage(.1f) // set red indicator for 10%
      .startingGravity(Gravity.TOP)
      .startingXPosition(200)
      .startingYPosition(600)
      .show(this);
      

   //you can add a callback to get frame times and the calculated
   //number of dropped frames within that window
   TinyDancer.create(this)
       .addFrameDataCallback(new FrameDataCallback() {
          @Override
          public void doFrame(long previousFrameNS, long currentFrameNS, int droppedFrames) {
             //collect your stats here
          }
        })
        .show();
  }
}

dump 的数据格式

当调用 TinyDancer.install(this); 或者 TinyDancer对象的destroy()函数时 时 会为每个 Activity 产生一份FPS数据, 目录为 Environment.getExternalStorageDirectory().getPath()/应用包名/fps/. 数据格式为

activity : Activity的完整名字
58,55,57,59,60,60
Max: 60
Min: 55
Avg: 58

代表某个Activity在各个时间段内的FPS值,最高为60(最流畅), 最低为0, 以及最大、最小、平均的FPS值。

You're good to go! Tiny Dancer will show a small draggable view overlay with FPS as well as a color indicator of when FPS drop. You can double tap the overlay to explicitly hide it.

See sample application that simulates excessive bind time:

Tiny Dancer Sample

Have an project with performance issues? We'd be happy to help tune it.

tinydancer's People

Contributors

brianplummer avatar digitalbuddha avatar hehonghui avatar jaredsburrows avatar firezenk avatar

Watchers

 avatar  avatar

Forkers

wangyali99

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.