Remote Script Profiler
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
vendor
.gitignore
LICENSE
Makefile
README.md
package.json

README.md

rsprofiler - Remote Script Profiler

⎙ View a demo of rsprofiler in action

Turns out you can use the following little fragment in JavaScript in the iOS 6 to generate profiling data, if you connect to remote web inspector FIRST:

console.profile("my slow code")
callMySlowCode()
console.profileEnd()

After console.profileEnd() completes, you will have a chunk of data available in the console.profiles array.

Now, what to do with it ...

install the rsprofiler server

For now, git clone this repo.

run the rsprofiler server

If you've npm -g installed the package:

rsprofiler --help # prints some help
rsprofiler 3000   # starts a server  

From the rsprofiler directory:

./lib/cli.js 3000 # starts a server
make watch        # run server under node-supervisor on 3000

use the rsprofiler server

The rsprofiler server does a few different things.

serves up rsprofiler-target.js for your to-be-profiled page

<script src="http://example.com:port/rsprofiler-target.js"></script>

This script exposes the rsprofiler global variable. See API below.

serves up profile browser

Head over to http://localhost:port/ to browse through captured profiles.

the rsprofiler global variable

This variable has the following properties:

supported

Contains a boolean value, indicating whether or not rsprofiler is supported in this browser.

start(<name>)

Starts a new profiling session. If a session has already been started, but not not yet stopped, calling this function is a no-op.

stop(<callback>)

Stops the previously started profiling session. If no session has been started calling this function is a no-op.

If a callback function is passed in, it will be invoked as follows:

callback.apply(null, error)

If error is null, then success!

workflow

  • start the rsprofiler server
  • include the rsprofiler-target.js file in your web page
  • run your browser page / app on iOS 6
  • connect to your page / app via remote Web Inspector
  • trigger the action(s) that will trigger rsprofiler.start() and .stop() to run
  • visit your rsprofiler server in your desktop browser for views of the profiling data

license

Tumbolia Public License

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.

TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  1. opan saurce LOL

attributions

The tilted stopwatch image with green filling was adapted from StopWatch designed by Irit Barzily from The Noun Project.

The garbage can image was adapted from Trash Can designed by Chris Lee from The Noun Project.