Chronometro


Source link: https://github.com/TV4/chronometro

Chronometro

The Chronometro plugin is a benchmarking plugin for Android Studio.

It provides the information on loading times of any kind of functionality that may be found in the Android application. Benchmarking is not a trivial task on Android when taking into account the life cycle of activities and fragments. Thus, this plugin appears to be very handy when one needs to track the completion of the network calls in relation to that.

The plugin provides the annotation that is used to mark the methods that are going to be tracked. At the same time the checkpoints are provided if one would like to have a report on loading time in a current point of execution without stopping the timer.

Chronometro is based on Aspect Oriented Programming for Android and uses the AspectJ library.

Chronometro finds its inspiration in:

Usage

Chronometro annotations are added to the methods in interest.

@Chronometro(state = Chronometro.START, name = "Fragment1") @Override public void onAttach(Activity activity) {

super.onAttach(activity);

// some code here 
}

@Chronometro(state = Chronometro.END, name = "Fragment1") @Override public void onDataSuccess(Data data) {

// some code here 
}

Example of result logs:

Chronometro --> Fragment1 started Chronometro --> Fragment1 created --> [2000ms]

One may define several timers y providing a different name value in the annotation.

The plugin provides also checkpoints so the developer can get the loading times for methods that run between the starting and ending point. Here are the two states that are available for getting the loading time right before the method runs (Chronometro.CHECKPOINT_START) and one right after (Chronometro.CHECKPOINT_END)

// logging the time until after the view has been created @Chronometro(state = Chronometro.CHECKPOINT_END, name = "Fragment1") @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {

super.onViewCreated(view, savedInstanceState);

// some code here 
}

// logging the time until before the fetching of data @Chronometro(state = Chronometro.CHECKPOINT_START, name = "Fragment1") @Override private void fetchData() {

// some code here 
}

Example of logs at the checkpoints:

  Chronometro --> Fragment1 checkpoint after method onViewCreated --> [68ms]
Chronometro --> Fragment1 checkpoint before method fetchData --> [108ms]

To integrate the plugin into your project, please add the following code to your Gradle file:

buildscript {

repositories {

  jcenter()

}
  dependencies {

classpath 'se.tv4:chronometro-plugin:0.4.0'

}
 
}
  apply plugin: 'com.android.application' apply plugin: 'chronometro'

OBS! If you are using android-data-binding in your project, make sure you have at least rc3 version.

classpath 'com.android.databinding:dataBinder:1.0-rc3'

License

Copyright 2015, TV4 AB.  Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License. You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 

Resources

AndroidResizer is a simple Java desktop app for automatically re-sizing android assets.

AR will downscale your assets and copy them into an android-style folder structure.

Android & Pure Java library to shape a voice with an instrument.

NaturalLenguageProcessor is an Android library that wraps text-processing.com API and gives you the possibility to stem, to tag and to analyze sentimentally the text you want.

Layout that contains a ViewPager and can slide vertically between 2 states (expanded and collapsed).

NodeFlow is an Android library that provides a simple way to visualize hierarchical content. Perfect for displaying items that are organized in categories / subcategories.

Android library for boilerplate destruction - "Just code what is worth coding"

  • Generates boilerplate code based on used annotations and lets you focus on what matters.
  • Generated code is fully traceable.
  • Everything is generated during compile time.
  • No reflection used!
  • Consists of modules.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes