Permalink
Switch branches/tags
Nothing to show
Commits on Apr 14, 2017
  1. Lint ignore for khan-linter upgrade

    cjfuller committed Apr 14, 2017
    Summary:
    
    See D35059.  This change is the output of webapp's:
    `tools/add_lint_ignore_lines.py --todo_target colin ~/khan/gae_mini_profiler`
    
    Also manually removed unused imports from unformatter/__init__.py
    
    Test Plan:
    `~/khan/devtools/khan-linter/runlint.py .`
    
    Auditors: csilvers
Commits on Dec 8, 2016
  1. Add an icon for error logs to the mini profiler

    benjaminjkraft committed Dec 8, 2016
    Summary:
    The mini profiler has a bunch of little icons when various potentially-bad
    things happen.  But an error log have one -- you have to open up the request to
    have any hint of it!  Now it will -- we'll show a little orange thingy for
    errors and a red one for criticals.
    
    Screenshot: {F594796}
    
    Test Plan:
    Substate into webapp, and edit `RequestHandler.dispatch` to log an error always
    and a critical sometimes randomly, and see things like the above screenshot.
    
    Reviewers: chris
    
    Reviewed By: chris
    
    Differential Revision: https://phabricator.khanacademy.org/D32513
  2. Merge pull request #85 from cpatulea/patch-2

    benjaminjkraft committed on GitHub Dec 8, 2016
    Requires jquery >= 1.7
Commits on Dec 6, 2016
  1. Requires jquery >= 1.7

    cpatulea committed on GitHub Dec 6, 2016
Commits on Aug 23, 2016
  1. Support memcache chunking in the sampling profiler.

    csilvers committed Aug 23, 2016
    Summary:
    Now we'll be able to show sampled profile results even if the
    pickled+compressed output is >1M.
    
    Test Plan:
    Deployed a znd that used this new code, and used the sampling profiler
    on the homepage of a new request to see how long it took
    get_path_table() to run (I deleted the `@layer_cache` for
    get_path_table() first).  I saw the mini-profiler dropdown appear,
    whereas before it didn't, and could visualize the profile.
    
    Reviewers: chris, benkraft
    
    Reviewed By: benkraft
    
    Differential Revision: https://phabricator.khanacademy.org/D30226
Commits on Aug 5, 2016
  1. Catch requests made with `fetch` and show profiler data about them

    xymostech committed Jun 27, 2016
    Summary:
    This miniprofiler only listened to the `ajaxComplete` event, which
    means that it doesn't catch data about requests made with `fetch` (which
    `khanFetch` uses internally).
    
    This adds support for getting data about requests made with `fetch` by making a
    wrapper around `fetch` that listens for the appropriate headers.
    
    Test Plan:
     - Visit http://localhost:8080/react-sandbox?mini_profilerk=1
     - In the console, run
    ```
    khanFetch = KAdefine.require("./javascript/shared-package/khan-fetch.js").khanFetch
    khanFetch("/api/internal/test/add-notification")
    ```
     - See that results in the mini profiler show up for that request: {F545097}
    
    Reviewers: william, john
    
    Reviewed By: william, john
    
    Differential Revision: https://phabricator.khanacademy.org/D28564
Commits on Apr 19, 2016
  1. Allow passing a sleep_fxn, similar to time_fxn

    benjaminjkraft committed Apr 15, 2016
    Summary:
    KA's time-mocking in tests now also mocks time.sleep to simply advance the fake
    datetime and return immediately.  This breaks the sampling profiler, so we need
    to pass in the real `time.sleep` similarly to how we pass in the real
    `time.time`.
    
    Test Plan:
    * in `webapp`, run `tools/runtests.py -p route_util.coverage_test`, it doesn't
      spin forever.
    * in `webapp`, load `localhost:8080` with the mini-profiler enabled and set to
      sampling profiler, and see the sampled profiles still work.
    
    Reviewers: csilvers
    
    Reviewed By: csilvers
    
    Differential Revision: https://phabricator.khanacademy.org/D26619
Commits on Dec 9, 2015
  1. Merge pull request #77 from lipis/reformat-readme

    benjaminjkraft committed Dec 9, 2015
    Reformat README
  2. Reformat README

    lipis committed Nov 12, 2015
Commits on Oct 13, 2015
Commits on May 20, 2015
  1. Create .arclint

    nsfmc committed May 20, 2015
    summary: add `.arclint` file now that lint engines are deprecated in global .arcconfig files.
    
    auditors: chris
Commits on Dec 5, 2014
  1. Fix flame chart visualization in Chrome 39

    chrisklaiber committed Dec 5, 2014
    Now height is needed on the HTML element. It wasn't in Chrome 38.
    
    Auditors: mattfaus
    
    Test Plan:
    Load flame chart visualization for the sampling profiler in Chrome 39
    and see that the display is no longer truncated vertically to about a
    hundred pixels like it was before the fix.
Commits on Nov 26, 2014
  1. Update this to use the new SSL phabricator.

    csilvers committed Nov 26, 2014
    Auditors: kamens
    
    Test plan:
    None
Commits on Oct 24, 2014
  1. Add a collapse button to gae_mini_profiler

    MattFaus committed Oct 24, 2014
    Summary:
    Some people don't like to see the mini profiler in their face all the time. It can also impede UI iteration since it overlays things. So, I added this button that allows you to collapse the widget. The "hidden" setting persists through page refreshes via a cookie.
    
    I did my best on "designing" this button to be tiny, but I'm not really happy with it, so I'm very open to CSS/HTML tips on making it more usable.
    
    Test Plan:
    Load up any page locally, see the mini profiler with the new collapse button, click it
    Notice the entries are hidden.
    Trigger some more RPCs on the page (hover over the learn menu), notice the entries are still hidden
    Click the open button, to display the entries again. Everything behaves as normal.
    Click to close, hard-refresh the page. Notice that the entries are still collapsed
    
    Reviewers: csilvers, alan
    
    Subscribers: jace, alpert
    
    Differential Revision: http://phabricator.khanacademy.org/D14150
Commits on Oct 6, 2014
  1. Integrate an embedded sampling profile viewer from Chrome DevTools

    chrisklaiber committed Oct 6, 2014
    Summary:
    With this, the flame chart visualization of a sampled profile is one
    click away and there's no need to open Chrome DevTools to see it.
    
    It only works in Chrome, so for other browsers we display unlinked text
    and a tooltip within the mini profiler.
    
    The license for the included DevTools code from the chromium project
    lives in static/chrome/inspector-20140603/devtools.html
    
    Test Plan:
    Loaded up mini profiler in Chrome on the KA homepage, clicked the
    "Visualize" link in the mini profiler's profile view, and saw the new
    tab open with a flame chart visualization.
    
    Then I loaded up mini profiler in Safari and saw the unlinked text
    "Visualize in Chrome".
    
    Reviewers: desmond, jlfwong
    
    Reviewed By: jlfwong
    
    Subscribers: alan, ben, marcos
    
    Differential Revision: http://phabricator.khanacademy.org/D13549
Commits on Sep 26, 2014
  1. Drop instrumented profile from the default mode

    chrisklaiber committed Sep 26, 2014
    Summary:
    Enabling the instrumented profile slows the request significantly and in
    usage I've observed it's not worth having on by default in either
    development or production. The RPC trace is important enough often
    enough to have on by default, it's often the case that a repeat of the
    same request has a different RPC trace due to server-side caching.
    
    Test Plan:
    Loaded a page with mini profiler and no cookie, saw that I got an RPC
    trace but not an instrumented profile. Loaded the "Settings" pane and
    say that "CPU profiling" is disabled and "RPC profiling" is enabled.
    
    Reviewers: alpert, desmond
    
    Reviewed By: desmond
    
    Differential Revision: http://phabricator.khanacademy.org/D13413
Commits on Sep 25, 2014
  1. Merge branch 'bslatkin-master'

    chrisklaiber committed Sep 25, 2014
    The code has changed since this patch came in so I carried forward its
    spirit by updating newer os.environ["SERVER_SOFTWARE"] accesses it
    didn't account for.
    
    Conflicts:
    	profiler.py
    	static/js/profiler.js
  2. Merge branch 'lipis-patch-1'

    chrisklaiber committed Sep 25, 2014
    Kept our jQuery (1.11.0 > 1.9.1) and the protocol-relative URL from lipis
    
    Conflicts:
    	templates/shared.html
Commits on Aug 31, 2014
  1. Improve .cpuprofile download

    sophiebits committed Aug 31, 2014
    Summary:
    - Include request timestamp in filename to make finding the correct file easier
    - Use URL field properly instead of including in "function name"
    - Set callUID to a unique per-function ID instead of the call ID to match Chrome's behavior, allowing calls to the same function to be grouped together properly
    
    Test Plan:
    Profiled loading /style with the old and new code.
    
    Old:
    
    {F51040}
    
    New:
    
    {F51042}
    
    (Not exactly the same profile, but note that readline is now properly one entry instead of 3+ in the first screenshot.)
    
    Reviewers: chris, alan
    
    Reviewed By: alan
    
    Subscribers: jessie
    
    Differential Revision: http://phabricator.khanacademy.org/D12799
Commits on Aug 7, 2014
  1. Merge pull request #52 from rsamuelklatchko/master

    kamens committed Aug 7, 2014
    Thread safety changes
Commits on Aug 4, 2014
  1. Allow passing in a function to use instead of time.time.

    benjaminjkraft committed Aug 4, 2014
    Summary: This is useful, for example, if time.time is mocked out in tests.
    
    Test Plan:
    Hooked it up to the test runner, it worked.  Tested in-browser that it didn't
    break anything.
    
    Reviewers: alan
    
    Reviewed By: alan
    
    Differential Revision: http://phabricator.khanacademy.org/D11904
Commits on Aug 2, 2014
  1. Add link to .cpuprofile to GAE Mini Profiler.

    benjaminjkraft committed Aug 1, 2014
    Summary:
    {F40129}
    {F40131}
    
    Test Plan: Load a page, check that it works and imports into chrome happily.
    
    Reviewers: alan
    
    Reviewed By: alan
    
    Differential Revision: http://phabricator.khanacademy.org/D11851
  2. Add sampling profiler method to dump to .cpuprofile format.

    benjaminjkraft committed Jul 31, 2014
    Summary:
    It's currently not hooked up to anything, but if you run the sampling profiler
    manually, write Profiler.cpuprofiler_results() to a file, and upload that to
    Chrome, it should work.
    {F40100}
    
    Known issue: the very last sample gets displayed a bit weirdly.  I'll fix this if I
    have time, but it's not a huge issue since in real things we want to optimize
    we'll probably have tens or hundreds of samples.
    
    Test Plan:
    Profiled time.sleep() from the dev shell, loaded the profile into chrome,
    checked that things looked reasonable.
    
    Reviewers: alan
    
    Reviewed By: alan
    
    Differential Revision: http://phabricator.khanacademy.org/D11844
Commits on Jul 24, 2014
  1. Make mini profiler detail window float at the top of the page

    benjaminjkraft committed Jul 17, 2014
    Summary:
    Previously if you had a really long list of AJAX requests in the mini profiler,
    you would have to scroll down, click on one, and then scroll way up to the
    detail window.  This way, the detail window will float down the page with you.
    {F33796}
    
    Test Plan: Load a page, get it to make lots of AJAX requests.
    
    Reviewers: alan
    
    Reviewed By: alan
    
    Differential Revision: http://phabricator.khanacademy.org/D11272
  2. Add (M) icon for high-memory requests.

    benjaminjkraft committed Jul 16, 2014
    Summary:
    It goes right next to the (D) for duplicate RPCs.  It is pink for very
    high-memory requests (>10MB).
    
    Test Plan:
    Load pages, check that the icon appears when it should, and is the right color
    on various backgrounds.  Check that it doesn't break other profiling modes.
    
    Reviewers: alan
    
    Reviewed By: alan
    
    Differential Revision: http://phabricator.khanacademy.org/D11243
Commits on Jul 8, 2014
  1. Fix to sampling profiler when memory is turned off.

    benjaminjkraft committed Jul 8, 2014
    Test Plan: Load the homepage with sampling profiler, with and without memory sampling.
    
    Reviewers: alan
    
    Reviewed By: alan
    
    Differential Revision: http://phabricator.khanacademy.org/D10850
Commits on Jul 3, 2014
  1. Add a memory overview line when memory sampling is on.

    benjaminjkraft committed Jul 3, 2014
    Summary:
    Shows the initial, final, and maximum memory.  This should make it easier to
    see when there may be something worth looking at in the memory profile.
    
    Test Plan: Load the homepage.
    
    Reviewers: alan
    
    Reviewed By: alan
    
    Differential Revision: http://phabricator.khanacademy.org/D10625
Commits on Jun 28, 2014
  1. Increase memory sample rate.

    benjaminjkraft committed Jun 28, 2014
    Summary:
    The google.appengine.api.runtime API is faster than I thought, so it should be
    fine to bump up our sample rate.  This will increase the overhead a bit but
    also give more useful data.
    
    Test Plan: Load the homepage with the memory sampling profiler enabled.
    
    Reviewers: alan
    
    Reviewed By: alan
    
    Differential Revision: http://phabricator.khanacademy.org/D10577
  2. Improves sampling memory profiler display.

    benjaminjkraft committed Jun 28, 2014
    Summary:
    It will now show both the next and previous memory samples and the change
    between them, and show them in a nicer format.
    
    Screenshot: {F25090}
    
    Test Plan: Load the homepage with and without memory sampling enabled.
    
    Reviewers: alan
    
    Reviewed By: alan
    
    Differential Revision: http://phabricator.khanacademy.org/D10576
Commits on Jun 24, 2014
  1. Ignore GetSystemStatsRequest in duplicate RPC detection.

    benjaminjkraft committed Jun 24, 2014
    Summary:
    The memory profiler generates a lot of repeated calls to runtime.memory_usage()
    on prod.  These get marked as duplicate RPCs, even though they are intentional.
    More generally, two calls to the runtime API may return different data, and
    were likely intentionally duplicated, so they should not get marked as such in
    the profiler.
    
    Test Plan:
    Load /stats/memory (which makes multiple runtime.memory_usage() calls), check
    that they are no longer marked as duplicate RPCs.
    
    Reviewers: alan
    
    Reviewed By: alan
    
    Differential Revision: http://phabricator.khanacademy.org/D10411
  2. Adds missing import to memory sampling profiler.

    benjaminjkraft committed Jun 24, 2014
    Test Plan: Fingers crossed.
    
    Auditors: alan
  3. Fixes two little bugs in sampling memory profiler.

    benjaminjkraft committed Jun 24, 2014
    The display was breaking if memory sampling was off because I was using jQuery
    incorrectly, and I forgot to add the new option in one place.
    
    Test Plan:
    Load a page with the miniprofiler, with memory sampling both on and off.  Check
    that the profile renders correctly in both cases.
    
    Auditors: alan
  4. Add option to sampling profiler to additionally sample memory.

    benjaminjkraft committed Jun 24, 2014
    Summary:
    This adds an option to additionally sample memory.  Since memory sampling is
    slow on prod, it does it fairly infrequently.  (After some further profiling,
    we may be able to turn it up a bit.)
    
    Currently it does nothing on a dev server, since the dev server does not allow
    importing the python module, and does not return useful data from the prod
    runtime API.
    
    Screenshots:
    {F23421}
    {F23422}
    
    Test Plan:
    Set the dev server fallback to return random data instead of zero, to check
    that the interface work.  Test the profiler in the dev shell.  Will also test
    on staging.
    
    Reviewers: alan
    
    Reviewed By: alan
    
    Differential Revision: http://phabricator.khanacademy.org/D10320
Commits on Mar 23, 2014
  1. Fix occasional crash in the sampling profiler

    Alan Pierce committed Mar 23, 2014
    Summary:
    Before this commit, when the sampling profiler was finished, the main thread
    would set a flag for the sampling thread to stop profiling but wouldn't wait for
    the background thread to actually exit. This meant that the background thread
    would sometimes add one last sample to the list of samples while we were in the
    middle of processing that list. The Profile.results function makes two passes
    over the list of samples and assumes that they'll be the same both times, so it
    was crashing when the list got modified in the middle.
    
    The fix is to wait for the sampling thread to exit before processing the
    results.
    
    Test Plan:
    Temporarily put a sleep(1) just before the crash point and a sleep(.01) at the
    top of the top of the sampling loop. With these sleeps, the home page
    consistently crashes with sampling profiling enabled. Adding the join statement
    fixes this crash.
    
    Reviewers: ben
    
    Reviewed By: ben
    
    Subscribers: alpert
    
    Differential Revision: http://phabricator.khanacademy.org/D7621
Commits on Mar 11, 2014
  1. Update stack trace while moving sampling slider

    sophiebits committed Mar 11, 2014
    Summary: Not just when releasing! I definitely thought this worked before, but perhaps not...
    
    Test Plan: Dragged the "Time" slider for the sampling profiler, and saw the stack trace update while I dragged it, not just after mouseup.
    
    Reviewers: alan
    
    Reviewed By: alan
    
    Differential Revision: http://phabricator.khanacademy.org/D7255