Giter VIP home page Giter VIP logo

tinydancer's Introduction

DEPRECATED

TinyDancer is deprecated. No more development will be taking place. Check out the Google Android developer documentation for UI performance testing

Tiny Dancer

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.

New Double tap overlay to hide!

“Perf Matters” - Random Guy at Meetup

Tiny Dancer

Min SDK

Tiny Dancer min sdk is API 16

Unfortunately this will not work on Android TV

Getting started

In your build.gradle:

 dependencies {
   debugCompile "com.github.brianPlummer:tinydancer:0.1.2"
   releaseCompile "com.github.brianPlummer:tinydancer-noop:0.1.2"
   testCompile "com.github.brianPlummer:tinydancer-noop:0.1.2"
 }

In your DebugApplication class:

public class DebugApplication extends Application {

  @Override public void onCreate() {

   TinyDancer.create()
             .show(context);
             
   //alternatively
   TinyDancer.create()
      .redFlagPercentage(.1f) // set red indicator for 10%....different from default
      .startingXPosition(200)
      .startingYPosition(600)
      .show(context);

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

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. [email protected]

tinydancer's People

Contributors

aleien avatar brianplummer avatar digitalbuddha avatar firezenk avatar jaredsburrows avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tinydancer's Issues

Unable to build

Hello,
I cloned your project, but am unable to build the app. It throws an error:

No such property: GROUP for class: org.gradle.api.publication.maven.internal.deployer.DefaultGroovyMavenDeployer

Please advise.

launch crash on android 4.4 device

Caused by: java.lang.NullPointerException
at android.widget.TextView.getExtendedPaddingTop(TextView.java:1824)
at android.widget.TextView.getTotalPaddingTop(TextView.java:1918)
at com.codemonkeylabs.fpslibrary.ui.TinyCoach.(TinyCoach.java:54)
at com.codemonkeylabs.fpslibrary.TinyDancerBuilder.show(TinyDancerBuilder.java:94)
at com.codemonkeylabs.fpslibrary.sample.UI.MainActivity.onCreate(MainActivity.java:40)
at android.app.Activity.performCreate(Activity.java:5287)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1101)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159

Unable to start on Marshmallow

java.lang.RuntimeException: Unable to start service com.codemonkeylabs.fpslibrary.service.FPSService@6be9f23 with Intent { cmp=my.cool.app/com.codemonkeylabs.fpslibrary.service.FPSService (has extras) }: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@d29dcdd -- permission denied for this window type

Feature Request: Callback for extensibility

Allow users to extend the value of this tool easily. A callback called on each doFrame() which forwards the time between VSync and the dropped frames you've calculated could be valuable. The overlay is great, though extensibility here allows other devs to leverage the work you've done to simplify their performance measuring problems.

TinyDancer widget stays on screen even when application process is killed.

I noticed that TinyDancer widget stays on screen even when application process is killed, in matter of fact I killed all applications and still see it.

Widget went away after going to application manager -> my app and "force stop" it.

It happened on Samsung Note Edge 5.0.1.

Can we add touch event for long press on the widget with dialog popup to kill it?

Lower minSdkVersion ?

Any particular api call or functionality strictly depending on api level 16 ?
Wondering if it's feasible to lower it to 14 to support more devices.

Thanks
Robert

Remove attributes from manifest

In your library manifest you are setting the android:allowBackup and android:label attribute. It would be much easier to integrate your library, if the application wouldn't need to override those values.

Service

Can i use your library to show fps on a floating service ?

TinyDancer not visible

TinyDancer is not visible.
I have tried to add it in Application class onCreate() as well as Activity class onCreate().
TinyDancer.create()
.show(this);

Add CI

Add TravisCI for continuous integration builds

Better permission handling

At the moment if I try to launch TinyDancer for the first time on Marshmellow it'll ask me to grant permission which is ok, but then TinyDancer won't be displayed until I trigger hide and show manually.

Would be nice if TinyDancer will understand that permission was granted and then draw itself without need in manual hide/show!

If user hadn't granted permission then library could display a Toast "TinyDancer won't work without this permission" :)

Not compatible with Android TV?

I tried using TinyDancer in my Android TV project, but app kept crashing during startup. The reason was: java.lang.RuntimeException: Unable to create application com.android.tools.fd.runtime.BootstrapApplication: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.settings.action.MANAGE_OVERLAY_PERMISSION dat=package:com.mobitv.client.connect.tv flg=0x10000000 } - there's no activity in Android TV that can request for overlay permission. Seems that android.permission.SYSTEM_ALERT_WINDOW is missing in Android TV too, so there's probably no chance to use TinyDancer on TV.

Maybe it's worth mentioning in readme about this limitation?

Redesign demo

The demo looks like it is out of the 1800s, it would be nice to add some material styling to it.

Add CHANGELOG

Please add CHANGELOG.md :)

// You can grab format from the OkHttp for example.

Feature Request: Make compatible with Android Oreo 8.0

Hi
According to Android 8.0 Behavior Changes apps that target API 26 should now be using the TYPE_APPLICATION_OVERLAY instead of the SYSTEM_ALERT_WINDOW.

If not you get this nice stacktrace.

Caused by: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@c3386fe -- permission denied for window type 2002 at android.view.ViewRootImpl.setView(ViewRootImpl.java:789) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:356) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:92) at com.codemonkeylabs.fpslibrary.ui.TinyCoach.addViewToWindow(TinyCoach.java:80) at com.codemonkeylabs.fpslibrary.ui.TinyCoach.<init>(TinyCoach.java:52) at com.codemonkeylabs.fpslibrary.TinyDancerBuilder.show(TinyDancerBuilder.java:94) at com.foo.bar.MyApplication.initTinyDancer(MyApplication.kt:128) at com.foo.bar.MyApplication.onCreate(MyApplication.kt:76) at com.zeroturnaround.jrebel.android.agent.runtime.client.JRebelApplication.onCreate(SourceFile:139) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1118)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5791)  at android.app.ActivityThread.-wrap1(Unknown Source:0)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1661)  at android.os.Handler.dispatchMessage(Handler.java:105)  at android.os.Looper.loop(Looper.java:164)  at android.app.ActivityThread.main(ActivityThread.java:6541)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 

Thanks in advance.

Tim

Gradle dependency

Hey there,

I have some trouble resolving your dependency through gradle. I tried this as stated in the .md:

debugCompile "com.github.brianPlummer:tinydancer:0.1.1"

But always get this:

Error:Failed to resolve: com.github.brianPlummer:tinydancer:0.1.1

Can you please add some more infos on how to include your dependency? Maybe I am just missing the repo you uploaded to?

And from your uploading code it also looks like your .md is not up to date and you might have changed groupId or artifactId...

Hint: The Android Arsenal page did not help, but caused more confusion...

Thanks for you help 👍

Error:Program type already present: com.codemonkeylabs.fpslibrary.FrameDataCallback

I'm trying to add the library to my Android project but I get an error when I run the project
the Gradle build success with no error but when hit the run button I got this error before installing apk
Error:Program type already present: com.codemonkeylabs.fpslibrary.FrameDataCallback
Error:com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: /Users/omaraltamimi/AndroidStudioProjects/myproject/app/build/intermediates/transforms/dexBuilder/production/debug/0, /Users/omaraltamimi/AndroidStudioProjects/myproject/app/build/intermediates/transforms/dexBuilder/production/debug/1, /Users/omaraltamimi/AndroidStudioProjects/myproject/app/build/intermediates/transforms/dexBuilder/production/debug/2, /Users/omaraltamimi/AndroidStudioProjects/myproject/app/build/intermediates/transforms/dexBuilder/production/debug/3, ...............

Ignore builds with minSdk less than 16

Hello,
I like your library. But I cannot use it in my apps because they work with lower than minSdkVersion 16. Is there any way to modify this library so that it can be ignored on devices that run lower than sdk 16?

Thanks,
Igor

Import TinyDancer to my android studio project

I already have an android studio project. I just want to import the tinydancer pckage and add the code to show the fps.

But I can't import the tiny dancer package. Showing the error "can't import".

How to do this? Please tell me.

How to get the context information when app is stuck

We can use Choreographer.postFrameCallback to set callback when each frame execute, and we can get the frame time from this callback to judge wether app is stuck. My question is
When I find the APP stuck, How can I get the runtime context information, including the page that happened to be stuck, the time-consuming method, etc. Thanks

There was a typo in the class, TinyDancer, Content should be Context

There was a typo in the class, TinyDancer, Content should be Context

  • public static void hide(Content context) {
  • public static void hide(Context context) {

And I include the jar within an app, and the class TinyDancer could not be recoganized, maybe it causes by the jar consist with the typo.

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.