Giter VIP home page Giter VIP logo

gcmtest's Introduction

Android app and a script to test the latency of Google Cloud Messaging

Steps to Run
------------

1) Change API_KEY, mysql connection url in server/server.rb
2) cd server && bundle install && bundle exec ruby server.rb
3) Change SENDER_ID in GCMIntentService to your google project id
4) Change STATISTICS_ENDPOINT in GCMIntentService to your IP where the ruby script is running (step 1)
5) Deploy the android app to any number of devices / emulators
6) execute "watch -n 10 'curl -s http://localhost:4567/push'" <-- Pushed a message every 10 secs

Queries to get stats:
---------------------

1) Max latencies
select post_time, received_time, TIMESTAMPDIFF(SECOND, post_time, received_time) as latency from stats where received_time IS NOT NULL order by latency desc limit 5;

Sample Result:
+---------------------+---------------------+---------+
| post_time           | received_time       | latency |
+---------------------+---------------------+---------+
| 2012-12-16 23:32:13 | 2012-12-16 23:40:50 |     517 |
| 2012-12-18 09:39:28 | 2012-12-18 09:40:51 |      83 |
| 2012-12-18 15:02:49 | 2012-12-18 15:03:48 |      59 |
| 2012-12-18 15:02:59 | 2012-12-18 15:03:51 |      52 |
| 2012-12-18 15:03:10 | 2012-12-18 15:03:54 |      44 |
+---------------------+---------------------+---------+


2) Percentage of notifications received across time of the day
select HOUR(post_time) as posted_hour, (count(received_time)/count(*))*100 as percentage_of_messages_received from stats group by posted_hour;

+-------------+---------------------------------+
| posted_hour | percentage_of_messages_received |
+-------------+---------------------------------+
|           9 |                         25.9804 |
|          10 |                          6.2315 |
|          11 |                          5.9172 |
|          12 |                          4.0059 |
|          13 |                          3.2397 |
|          14 |                          3.1065 |
|          15 |                          7.4074 |
|          16 |                          6.5828 |
|          17 |                          5.0766 |
|          18 |                          3.3175 |
|          19 |                         20.2586 |
|          20 |                         11.5741 |
|          21 |                          0.7813 |
|          23 |                         18.0952 |
+-------------+---------------------------------+

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.