├── .gitignore ├── .gitmodules ├── .npmignore ├── .travis.yml ├── AUTHORS ├── BUILD.anvil ├── CONTRIBUTING.md ├── CONTRIBUTORS.md ├── KNOWN_ISSUES.md ├── LICENSE ├── README.md ├── addons ├── diagrams │ ├── diagrams-app.css │ ├── diagrams-app.js │ └── diagrams.json ├── test │ ├── test-addon-trace.js │ └── test-addon.json └── webglcapture │ ├── webglcapture.html │ └── webglgen.js ├── anvil.bat ├── app ├── BUILD.anvil ├── graphicsreplay-debug.html ├── graphicsreplay.html ├── icons │ ├── activity_indicator.gif │ ├── arrow_dropdown.svg │ ├── attachment.svg │ ├── autofilter_filled.svg │ ├── checkmark.svg │ ├── folder_open.svg │ ├── link.svg │ ├── move_left.svg │ ├── move_right.svg │ ├── pause.svg │ ├── play.svg │ ├── popout.svg │ ├── popout_white.svg │ ├── reset.svg │ ├── save.svg │ ├── seek_to_bottom.svg │ ├── seek_to_end.svg │ ├── seek_to_start.svg │ ├── seek_to_top.svg │ ├── settings.svg │ ├── skip_down.svg │ ├── skip_up.svg │ ├── sync.svg │ └── upload_item.svg ├── maindisplay-debug.html ├── maindisplay.html └── scripts │ ├── debug-graphicsreplay.js │ ├── debug-postfix-maindisplay.js │ ├── debug-prefix.js │ ├── release-graphicsreplay.js │ └── release-maindisplay.js ├── assets ├── BUILD.anvil ├── icons │ ├── chrometracing.png │ ├── chrometracing.svg │ ├── clear.png │ ├── clear.svg │ ├── gl.png │ ├── gl.svg │ ├── popout_white.png │ ├── popout_white.svg │ ├── save.png │ ├── save.svg │ ├── settings.png │ └── settings.svg └── store │ ├── screenshot-1.png │ ├── screenshot-2.png │ ├── tile-large.png │ ├── tile-marque.png │ └── tile-small.png ├── bin ├── controller.html ├── controller.js ├── cpp_src │ ├── Makefile │ ├── msbuild.vcxproj │ ├── webgl-header.cc │ ├── webgl-main.cc │ └── webgl-shared.h ├── diff.js ├── dump.js ├── generate-webgl-app.js ├── instrument.js ├── query.js ├── save-trace.js ├── tool-runner.js ├── trace-runner.js └── trace-server.js ├── bindings └── cpp │ ├── .clang-format │ ├── .gitignore │ ├── Makefile │ ├── README.md │ ├── buffer.cc │ ├── buffer_test.cc │ ├── event.cc │ ├── event_test.cc │ ├── include │ └── wtf │ │ ├── argtypes.h │ │ ├── buffer.h │ │ ├── config.h │ │ ├── event.h │ │ ├── macros.h │ │ ├── platform.h │ │ ├── platform │ │ ├── README.md │ │ ├── platform_aux_pthreads_threaded_impl.h │ │ ├── platform_aux_pthreads_threaded_inl.h │ │ ├── platform_aux_single_threaded_impl.h │ │ ├── platform_aux_single_threaded_inl.h │ │ ├── platform_aux_std_threaded_impl.h │ │ ├── platform_aux_std_threaded_inl.h │ │ ├── platform_default_impl.h │ │ ├── platform_default_inl.h │ │ ├── platform_myriad2sparc_impl.h │ │ └── platform_myriad2sparc_inl.h │ │ └── runtime.h │ ├── macros_test.cc │ ├── platform.cc │ ├── runtime.cc │ ├── runtime_test.cc │ ├── scripts │ └── run_clang_format.sh │ └── threaded_torture_test.cc ├── docs ├── addons.md ├── api.md ├── building.md ├── call_tracing.md ├── chrome_tracing.md ├── embedding.md ├── memory_tracing.md ├── node.md ├── options.md ├── overhead.md ├── quickstarts.md ├── style_guide.md ├── testing.md ├── webgl-apps.md ├── wtf-calls.md └── wtf-trace.md ├── extensions ├── wtf-injector-chrome │ ├── BUILD.anvil │ ├── assets │ │ └── icons │ │ │ ├── pageAction19.png │ │ │ ├── pageAction19.psd │ │ │ ├── pageAction38.png │ │ │ ├── pageAction38.psd │ │ │ ├── pageActionDisabled19.png │ │ │ ├── pageActionDisabled38.png │ │ │ ├── pageActionEnabled19.png │ │ │ ├── pageActionEnabled38.png │ │ │ ├── wtf-128.png │ │ │ ├── wtf-128.psd │ │ │ ├── wtf-16.png │ │ │ ├── wtf-32.png │ │ │ ├── wtf-32.psd │ │ │ └── wtf-48.png │ ├── background.js │ ├── debugger.js │ ├── extension.js │ ├── injectedtab.js │ ├── manifest.json │ ├── options.js │ ├── popup.html │ ├── popup.js │ ├── popup.less │ ├── third_party │ │ └── falafel.js │ ├── tracer.js │ ├── uri.js │ ├── wtf-call-tracing.js │ ├── wtf-injector.js │ └── wtf-process.js ├── wtf-injector-firefox │ ├── BUILD.anvil │ ├── README.md │ ├── data │ │ ├── BUILD.anvil │ │ ├── assets │ │ │ └── icons │ │ │ │ ├── wtf-32.png │ │ │ │ └── wtf-on-32.png │ │ ├── content-script.js │ │ ├── widget-panel.html │ │ ├── widget-panel.js │ │ ├── widget-panel.less │ │ ├── widget.html │ │ └── widget.js │ ├── doc │ │ └── main.md │ ├── icon.png │ ├── lib │ │ └── main.js │ ├── package.json │ └── test │ │ └── test-main.js └── wtf-instrument-proxy │ ├── background.js │ └── manifest.json ├── externs ├── analytics.js ├── chrome.js ├── drive.js └── node.js ├── package.json ├── scripts ├── prepare-publish.sh ├── run-benchmarks.js ├── run-benchmarks.sh ├── run-saucelabs.js ├── run-saucelabs.sh ├── run-tests.sh ├── setup.bat ├── setup.sh ├── update-benchmarks.sh ├── update-gh-pages.sh ├── update-third-party.sh └── update-version.sh ├── shims ├── wtf-trace-closure.js ├── wtf-trace-disabled.js └── wtf-trace.js ├── src └── wtf │ ├── addon │ ├── addon.js │ ├── appaddon.js │ ├── manifest.js │ ├── registry.js │ └── traceaddon.js │ ├── app │ ├── addonmanager.js │ ├── app.js │ ├── app.less │ ├── documentview.js │ ├── documentview.less │ ├── documentview.soy │ ├── exports.js │ ├── framepainter.js │ ├── granularity.js │ ├── graphics │ │ ├── canvaspanel.js │ │ ├── canvaspanel.less │ │ ├── canvaspanel.soy │ │ └── graphics.less │ ├── healthdialog.js │ ├── healthdialog.less │ ├── healthdialog.soy │ ├── helpdialog.js │ ├── helpdialog.less │ ├── helpdialog.soy │ ├── loader.js │ ├── maindisplay.js │ ├── maindisplay.less │ ├── maindisplay.soy │ ├── markpainter.js │ ├── nav │ │ ├── heatmappainter.js │ │ ├── nav.less │ │ ├── navbar.js │ │ ├── navbar.less │ │ ├── navbar.soy │ │ ├── statsbox.js │ │ ├── statsbox.less │ │ ├── statsbox.soy │ │ └── timelinepainter.js │ ├── query │ │ ├── query.less │ │ ├── querypanel.js │ │ ├── querypanel.less │ │ ├── querypanel.soy │ │ └── querytablesource.js │ ├── selection.js │ ├── selectionpainter.js │ ├── splashdialog.js │ ├── splashdialog.less │ ├── splashdialog.soy │ ├── statusbar.js │ ├── statusbar.less │ ├── statusbar.soy │ ├── tabbar.js │ ├── tabbar.less │ ├── tabbar.soy │ ├── tabpanel.js │ ├── tabpanel.less │ ├── toolbar.js │ ├── toolbar.less │ ├── toolbar.soy │ └── tracks │ │ ├── statisticstablesource.js │ │ ├── timerangepainter.js │ │ ├── trackinfobar.js │ │ ├── trackinfobar.less │ │ ├── trackinfobar.soy │ │ ├── tracks.less │ │ ├── trackspanel.js │ │ ├── trackspanel.less │ │ ├── trackspanel.soy │ │ └── zonepainter.js │ ├── bootstrap │ ├── mocha.js │ └── node.js │ ├── data │ ├── contextinfo.js │ ├── eventclass.js │ ├── eventflag.js │ ├── formats.js │ ├── variable.js │ ├── webidl.js │ └── zonetype.js │ ├── db │ ├── database.js │ ├── datasource.js │ ├── datasourceinfo.js │ ├── db.js │ ├── eventindex.js │ ├── eventiterator.js │ ├── eventlist.js │ ├── eventstatistics.js │ ├── eventstruct.js │ ├── eventtype.js │ ├── eventtypebuilder.js │ ├── eventtypetable.js │ ├── exports.js │ ├── filter.js │ ├── filterparser.js │ ├── filterparser.pegjs │ ├── filterparser_test.js │ ├── frame.js │ ├── framelist.js │ ├── framelist_test.js │ ├── healthinfo.js │ ├── mark.js │ ├── marklist.js │ ├── marklist_test.js │ ├── node.js │ ├── queryresult.js │ ├── sources │ │ ├── callsdatasource.js │ │ ├── chunkeddatasource.js │ │ └── cpuprofiledatasource.js │ ├── timerange.js │ ├── timerange_test.js │ ├── timerangelist.js │ ├── unit.js │ └── zone.js │ ├── doc │ ├── comment.js │ ├── commentscope.js │ ├── document.js │ ├── profile.js │ ├── profilescope.js │ └── view.js │ ├── events │ ├── commandmanager.js │ ├── eventemitter.js │ ├── eventfullist.js │ ├── eventfulmap.js │ ├── events.js │ ├── eventtype.js │ └── keyboard.js │ ├── hud │ ├── exports.js │ ├── hud.js │ ├── hud.less │ ├── livegraph.js │ ├── livegraph.less │ ├── overlay.js │ ├── overlay.less │ └── overlay.soy │ ├── io │ ├── blob.js │ ├── buffer.js │ ├── bufferview.js │ ├── cff │ │ ├── binarystreamsource.js │ │ ├── binarystreamtarget.js │ │ ├── chunk.js │ │ ├── chunks │ │ │ ├── eventdatachunk.js │ │ │ └── fileheaderchunk.js │ │ ├── chunktype.js │ │ ├── jsonstreamsource.js │ │ ├── jsonstreamtarget.js │ │ ├── part.js │ │ ├── parts │ │ │ ├── binaryeventbufferpart.js │ │ │ ├── fileheaderpart.js │ │ │ ├── jsoneventbufferpart.js │ │ │ ├── legacyeventbufferpart.js │ │ │ ├── resourcepart.js │ │ │ └── stringtablepart.js │ │ ├── parttype.js │ │ ├── streambase.js │ │ ├── streamsource.js │ │ └── streamtarget.js │ ├── drive.js │ ├── eventtype.js │ ├── io.js │ ├── io_test.js │ ├── readtransport.js │ ├── streaminghttpwritestream.js │ ├── stringtable.js │ ├── transports │ │ ├── blobreadtransport.js │ │ ├── blobwritetransport.js │ │ ├── filereadtransport.js │ │ ├── filewritetransport.js │ │ ├── memoryreadtransport.js │ │ ├── memorywritetransport.js │ │ ├── nullwritetransport.js │ │ ├── xhrreadtransport.js │ │ └── xhrwritetransport.js │ └── writetransport.js │ ├── ipc │ ├── channel.js │ ├── ipc.js │ └── messagechannel.js │ ├── math │ ├── math.js │ └── mersennetwister.js │ ├── pal │ ├── browserplatform.js │ ├── chromeplatform.js │ ├── iplatform.js │ ├── nodeplatform.js │ └── pal.js │ ├── remote │ ├── client.js │ ├── exports.js │ └── remote.js │ ├── replay │ ├── graphics │ │ ├── contextpool.js │ │ ├── contextpool_test.js │ │ ├── drawcallvisualizer.js │ │ ├── experiment.js │ │ ├── exports.js │ │ ├── extensionmanager.js │ │ ├── frameoverdrawvisualizer.js │ │ ├── frametimevisualizer.js │ │ ├── graphics.js │ │ ├── highlightvisualizer.js │ │ ├── offscreensurface.js │ │ ├── offscreensurface_test.js │ │ ├── overdrawsurface.js │ │ ├── overdrawvisualizer.js │ │ ├── playback.js │ │ ├── playback_test.js │ │ ├── program.js │ │ ├── program_test.js │ │ ├── replayframe.js │ │ ├── replayframe_test.js │ │ ├── session.js │ │ ├── session_test.js │ │ ├── skipcallsvisualizer.js │ │ ├── step.js │ │ ├── step_test.js │ │ ├── ui │ │ │ ├── argumentsdialog.js │ │ │ ├── argumentsdialog.less │ │ │ ├── argumentsdialog.soy │ │ │ ├── canvasarea.js │ │ │ ├── canvasarea.less │ │ │ ├── canvasarea.soy │ │ │ ├── contextbox.js │ │ │ ├── contextbox.less │ │ │ ├── contextbox.soy │ │ │ ├── eventnavigator.js │ │ │ ├── eventnavigator.less │ │ │ ├── eventnavigator.soy │ │ │ ├── eventnavigatorsource.js │ │ │ ├── eventnavigatortoolbar.js │ │ │ ├── eventnavigatortoolbar.less │ │ │ ├── eventnavigatortoolbar.soy │ │ │ ├── graphics.less │ │ │ ├── graphicspanel.js │ │ │ ├── graphicspanel.less │ │ │ ├── graphicspanel.soy │ │ │ ├── graphicstoolbar.js │ │ │ ├── graphicstoolbar.less │ │ │ ├── graphicstoolbar.soy │ │ │ ├── rangeseeker.js │ │ │ ├── rangeseeker.less │ │ │ ├── rangeseeker.soy │ │ │ └── replayframepainter.js │ │ ├── visualizer.js │ │ ├── webglstate.js │ │ └── webglstate_test.js │ └── timetravel │ │ ├── controller.js │ │ ├── controller.less │ │ ├── controller.soy │ │ ├── exports.js │ │ ├── replaysession.js │ │ ├── timetravel.js │ │ └── timetravel.less │ ├── testing │ ├── benchmark.html │ ├── benchmark.js │ ├── mocha-run.js │ ├── mocha.js │ ├── test.html │ └── testing.js │ ├── tests │ └── eventbuffers_test.js │ ├── timing │ ├── browserinterval.js │ ├── handle.js │ ├── renderinterval.js │ ├── rendertimer.js │ ├── timing.js │ └── util.js │ ├── trace │ ├── builtinevents.js │ ├── eventregistry.js │ ├── events.js │ ├── eventsessioncontext.js │ ├── eventtarget.js │ ├── eventtype.js │ ├── eventtypebuilder.js │ ├── exports.js │ ├── flow.js │ ├── instrument.js │ ├── node.js │ ├── prepare.js │ ├── provider.js │ ├── providers │ │ ├── chromedebugprovider.js │ │ ├── consoleprovider.js │ │ ├── domprovider.js │ │ ├── firefoxdebugprovider.js │ │ ├── imageprovider.js │ │ ├── providers.js │ │ ├── replayprovider.js │ │ ├── timingprovider.js │ │ ├── webglprovider.js │ │ ├── websocketprovider.js │ │ ├── webworkerprovider.js │ │ └── xhrprovider.js │ ├── scope.js │ ├── session.js │ ├── sessions │ │ ├── nullsession.js │ │ ├── snapshottingsession.js │ │ └── streamingsession.js │ ├── trace.js │ ├── tracemanager.js │ ├── util.js │ └── zone.js │ ├── ui │ ├── color │ │ ├── color.js │ │ └── palette.js │ ├── control.js │ ├── dialog.js │ ├── dialog.less │ ├── errordialog.js │ ├── errordialog.less │ ├── errordialog.soy │ ├── gridpainter.js │ ├── icons.js │ ├── painter.js │ ├── progressdialog.js │ ├── progressdialog.less │ ├── progressdialog.soy │ ├── rangepainter.js │ ├── rangerenderer.js │ ├── resizablecontrol.js │ ├── resizablecontrol_demo.html │ ├── rulerpainter.js │ ├── searchcontrol.js │ ├── settingsdialog.js │ ├── settingsdialog.less │ ├── settingsdialog.soy │ ├── styles │ │ ├── common.less │ │ ├── css3.less │ │ ├── kennedy.less │ │ └── reset.less │ ├── timepainter.js │ ├── tooltip.js │ ├── tooltip.less │ ├── ui.less │ ├── virtualtable.js │ ├── virtualtable.less │ ├── virtualtable.soy │ ├── virtualtablesource.js │ └── zoom │ │ ├── element.js │ │ ├── itarget.js │ │ ├── spring.js │ │ ├── viewport.js │ │ └── zoom.js │ ├── util │ ├── canvas.js │ ├── functionbuilder.js │ ├── options.js │ ├── options_test.js │ ├── util.js │ └── util_test.js │ ├── version.js │ └── wtf.js ├── test ├── benchmarks.js ├── benchmarks │ ├── dom.js │ ├── scopes.js │ ├── simple.js │ └── tracetypes.js ├── data │ ├── combined-1.wtf-json │ ├── combined-2.wtf-json │ ├── deeply-nested.wtf-json │ └── out-of-order.wtf-json ├── events.html ├── nodemanual.js ├── nodetest.js ├── replay-host.js ├── settimeout.html ├── test-blank.html ├── test-db-uncompiled.html ├── test-db.html ├── test-iframe-child.html ├── test-iframe.html ├── test-js.html ├── test-remote.html ├── test-replay.html ├── test-scripts-body-post.js ├── test-scripts-body-pre.js ├── test-scripts-head.js ├── test-scripts-remote.js ├── test-scripts.html ├── test-uncompiled.html ├── test-xhr.html └── test.html ├── third_party ├── BUILD.anvil └── d3 │ ├── BUILD.anvil │ ├── LICENSE │ ├── colorbrewer.js │ ├── d3.v3.js │ ├── d3.v3.min.js │ └── sankey.js └── wtfrc /.gitignore: -------------------------------------------------------------------------------- 1 | # ============================================================================== 2 | # Misc system junk 3 | # ============================================================================== 4 | 5 | .DS_Store 6 | ._* 7 | .Spotlight-V100 8 | .Trashes 9 | .com.apple.* 10 | Thumbs.db 11 | Desktop.ini 12 | 13 | # ============================================================================== 14 | # Projects/IDE files 15 | # ============================================================================== 16 | 17 | # Sublime Text 18 | *.sublime-project 19 | *.sublime-workspace 20 | 21 | # VIM 22 | .*.sw[a-z] 23 | *.un~ 24 | Session.vim 25 | 26 | # TextMate 27 | *.tmproj 28 | *.tmproject 29 | tmtags 30 | 31 | # Eclipse 32 | .project 33 | .metadata 34 | 35 | # ============================================================================== 36 | # Temp generated code 37 | # ============================================================================== 38 | 39 | *.py[co] 40 | .coverage 41 | *.o 42 | 43 | # ============================================================================== 44 | # Logs and dumps 45 | # ============================================================================== 46 | 47 | npm-debug.log 48 | private/ 49 | 50 | # ============================================================================== 51 | # Build system output 52 | # ============================================================================== 53 | 54 | # npm/node 55 | .lock-wscript 56 | node_modules/ 57 | node_modules/**/build/ 58 | node_modules/.bin/ 59 | 60 | # coverage/etc 61 | scratch/ 62 | 63 | .anvil-cache 64 | .build-cache/ 65 | build-out/ 66 | build-gen/ 67 | build-bin/ 68 | build-test/ 69 | 70 | # ============================================================================== 71 | # WTF 72 | # ============================================================================== 73 | 74 | ./manifest.json 75 | hydrogen.cfg 76 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "third_party/closure-compiler"] 2 | path = third_party/closure-compiler 3 | url = https://github.com/benvanik/google-closure-compiler-bin.git 4 | [submodule "third_party/closure-templates"] 5 | path = third_party/closure-templates 6 | url = https://github.com/benvanik/google-closure-templates-bin.git 7 | [submodule "third_party/closure-stylesheets"] 8 | path = third_party/closure-stylesheets 9 | url = https://github.com/benvanik/google-closure-stylesheets-bin.git 10 | [submodule "third_party/anvil-build"] 11 | path = third_party/anvil-build 12 | url = https://github.com/google/anvil-build.git 13 | [submodule "third_party/closure-linter"] 14 | path = third_party/closure-linter 15 | url = https://github.com/knutwalker/google-closure-linter.git 16 | [submodule "third_party/normalize.css"] 17 | path = third_party/normalize.css 18 | url = https://github.com/necolas/normalize.css.git 19 | [submodule "third_party/closure-library"] 20 | path = third_party/closure-library 21 | url = https://github.com/google/closure-library.git 22 | [submodule "third_party/firefox-addon-sdk"] 23 | path = third_party/firefox-addon-sdk 24 | url = https://github.com/mozilla/addon-sdk.git 25 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | # Don't remove this file. It is needed to prevent npm from looking in the 2 | # .gitignore file and excluding our build output from the package. 3 | # What a terrible feature. Sigh. 4 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # This is a list of contributors 2 | 3 | # Names should be added to this file like so: 4 | # Name or Organization 5 | 6 | Google, Inc. 7 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Have a fix or feature? Submit a pull request - we love them! 4 | 5 | ## Paperwork 6 | 7 | As this is a Google project, you *must* first e-sign the [Google Contributor License Agreement](https://developers.google.com/open-source/cla/individual) before we can accept any code. You only need to do this once for any Google project. 8 | 9 | ## Style 10 | 11 | We follow the Google style guides for each language used in the project. Since this code is used internally at Google we're pretty strict on this bit. See more information on the docs: [style_guide](https://github.com/google/tracing-framework/blob/master/docs/style_guide.md). 12 | 13 | ## Testing 14 | 15 | Follow the [testing](https://github.com/google/tracing-framework/blob/master/docs/testing.md) procedures before submitting pull requests. The [Travis CI](http://travis-ci.org) bot will yell at you if you try to submit code that doesn't work. 16 | -------------------------------------------------------------------------------- /CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | Contributors 2 | ------------ 3 | 4 | Names should be added to this file like so: `Name or Organization ` 5 | 6 | * Ryan Sturgell 7 | * Ben Vanik 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2012, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /addons/diagrams/diagrams-app.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Styles for the diagram extension. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | .panelRoot { 15 | } 16 | 17 | svg { 18 | font: 10px sans-serif; 19 | } 20 | 21 | .axis path, .axis line { 22 | fill: none; 23 | stroke: #000; 24 | shape-rendering: crispEdges; 25 | } 26 | 27 | .node rect { 28 | cursor: move; 29 | fill-opacity: .9; 30 | shape-rendering: crispEdges; 31 | } 32 | 33 | .node text { 34 | pointer-events: none; 35 | text-shadow: 0 1px 0 #fff; 36 | } 37 | 38 | .link { 39 | fill: none; 40 | stroke: #000; 41 | stroke-opacity: .2; 42 | } 43 | 44 | .link:hover { 45 | stroke-opacity: .5; 46 | } 47 | -------------------------------------------------------------------------------- /addons/diagrams/diagrams.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Diagrams", 3 | "required_version": "1.0.5", 4 | "app": { 5 | "scripts": [ 6 | "diagrams-app.js" 7 | ], 8 | "stylesheets": [ 9 | ] 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /addons/test/test-addon-trace.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 3 | // Add a HUD button: 4 | wtf.hud.addButton({ 5 | title: 'hello', 6 | icon: 'data:image/svg+xml;utf8,', 7 | shortcut: 'f3', 8 | callback: function() { 9 | console.log('hello!'); 10 | }, 11 | scope: null 12 | }); 13 | 14 | console.log('test addon loaded', wtf); 15 | 16 | })(); 17 | -------------------------------------------------------------------------------- /addons/test/test-addon.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "My Addon", 3 | "required_version": "1.0.5", 4 | "tracing": { 5 | "scripts": [ 6 | "test-addon-trace.js" 7 | ] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /anvil.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | third_party\anvil-build\anvil-local.bat %* 4 | -------------------------------------------------------------------------------- /app/graphicsreplay-debug.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | WTF Graphics Replay (DEBUG) 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/graphicsreplay.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | WTF Graphics Replay 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/icons/activity_indicator.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/app/icons/activity_indicator.gif -------------------------------------------------------------------------------- /app/icons/arrow_dropdown.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/icons/attachment.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | -------------------------------------------------------------------------------- /app/icons/autofilter_filled.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/icons/checkmark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/icons/folder_open.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/icons/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /app/icons/move_left.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/icons/move_right.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/icons/pause.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/icons/play.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/icons/popout.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/icons/popout_white.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/icons/reset.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/icons/save.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | -------------------------------------------------------------------------------- /app/icons/seek_to_bottom.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/icons/seek_to_end.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/icons/seek_to_start.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/icons/seek_to_top.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/icons/settings.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /app/icons/skip_down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/icons/skip_up.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/icons/sync.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/icons/upload_item.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/maindisplay-debug.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Web Tracing Framework (DEBUG) 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/maindisplay.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Web Tracing Framework 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/scripts/debug-graphicsreplay.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Debug mode runner for graphics replay. 10 | * 11 | * @author chizeng@google.com (Chi Zeng) 12 | */ 13 | 14 | 15 | debugImportAndExecute([ 16 | 'wtf.replay.graphics' 17 | ], function() { 18 | // Get the trace URL. 19 | var search = window.location.search; 20 | if (!search || !search.length || !(search.indexOf('?url=') == 0)) { 21 | throw new Error( 22 | 'No trace URL specified. Specify the trace URL after \'?url=\'.'); 23 | } 24 | var traceUrl = search.substr(5); 25 | 26 | var parentElement = document.getElementById('graphicsReplayStagingArea'); 27 | wtf.replay.graphics.setupWithUrl(traceUrl, parentElement); 28 | }); 29 | -------------------------------------------------------------------------------- /app/scripts/debug-postfix-maindisplay.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Postfix for the main display page in debug mode. 10 | * This should be included last, after Closure base.js and deps.js. 11 | * 12 | * @author benvanik@google.com (Ben Vanik) 13 | */ 14 | 15 | 16 | debugImportAndExecute([ 17 | 'wtf.app' 18 | ], function() { 19 | wtf.app.show({ 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /app/scripts/release-graphicsreplay.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Release mode graphics replay runner. 10 | * 11 | * @author chizeng@google.com (Chi Zeng) 12 | */ 13 | 14 | // Get the trace URL. 15 | var search = window.location.search; 16 | if (!search || !search.length || search.indexOf('?url=') != 0) { 17 | throw new Error( 18 | 'No trace URL specified. Specify the trace URL after \'?url=\'.'); 19 | } 20 | var traceUrl = search.substr(5); 21 | 22 | var parentElement = document.getElementById('graphicsReplayStagingArea'); 23 | wtf.replay.graphics.setupWithUrl(traceUrl, parentElement); 24 | -------------------------------------------------------------------------------- /app/scripts/release-maindisplay.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Release mode UI page runner. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | 15 | var _gaq = _gaq || []; 16 | _gaq.push(['_setAccount', 'UA-37275478-1']); 17 | _gaq.push(['_setSessionCookieTimeout', 0]); 18 | _gaq.push(['_trackPageview', '/maindisplay']); 19 | 20 | // Only include analytics when not on localhost. 21 | if (window.location.hostname != 'localhost') { 22 | (function() { 23 | var ga = document.createElement('script'); 24 | ga.type = 'text/javascript'; 25 | ga.async = false; 26 | ga.src = 'https://ssl.google-analytics.com/ga.js'; 27 | var s = document.getElementsByTagName('script')[0]; 28 | s.parentNode.insertBefore(ga, s); 29 | })(); 30 | } 31 | 32 | 33 | // Launch UI. 34 | wtf.app.show({ 35 | }); 36 | -------------------------------------------------------------------------------- /assets/BUILD.anvil: -------------------------------------------------------------------------------- 1 | # Copyright 2012 Google Inc. All Rights Reserved. 2 | 3 | __author__ = 'benvanik@google.com (Ben Vanik)' 4 | 5 | 6 | # Assets rules. 7 | # These are used to build javascript code with embedded data assets. 8 | 9 | 10 | ICON_WRAPPER=''.join([ 11 | "wtf.ui.icons.setIconData(", 12 | "'/assets/%path%', ", 13 | "'data:image/png;base64,%output%'", 14 | ");\n" 15 | ]) 16 | 17 | 18 | # ------------------------------------------------------------------------------ 19 | # HUD 20 | # ------------------------------------------------------------------------------ 21 | 22 | embed_files( 23 | name='hud_icons', 24 | srcs=[ 25 | ] + glob('icons/*.png'), 26 | wrapper=ICON_WRAPPER, 27 | encoding='base64', 28 | replace_chars=[['\n', '\\n'], ['\'', '\\\'']]) 29 | -------------------------------------------------------------------------------- /assets/icons/chrometracing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/assets/icons/chrometracing.png -------------------------------------------------------------------------------- /assets/icons/chrometracing.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /assets/icons/clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/assets/icons/clear.png -------------------------------------------------------------------------------- /assets/icons/clear.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /assets/icons/gl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/assets/icons/gl.png -------------------------------------------------------------------------------- /assets/icons/gl.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /assets/icons/popout_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/assets/icons/popout_white.png -------------------------------------------------------------------------------- /assets/icons/popout_white.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /assets/icons/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/assets/icons/save.png -------------------------------------------------------------------------------- /assets/icons/save.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | -------------------------------------------------------------------------------- /assets/icons/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/assets/icons/settings.png -------------------------------------------------------------------------------- /assets/icons/settings.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /assets/store/screenshot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/assets/store/screenshot-1.png -------------------------------------------------------------------------------- /assets/store/screenshot-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/assets/store/screenshot-2.png -------------------------------------------------------------------------------- /assets/store/tile-large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/assets/store/tile-large.png -------------------------------------------------------------------------------- /assets/store/tile-marque.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/assets/store/tile-marque.png -------------------------------------------------------------------------------- /assets/store/tile-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/assets/store/tile-small.png -------------------------------------------------------------------------------- /bin/cpp_src/Makefile: -------------------------------------------------------------------------------- 1 | ifeq ($(src),) 2 | src := *.cc 3 | endif 4 | 5 | obj := $(patsubst %.cc,%.o,$(wildcard $(src))) 6 | 7 | .PHONY: all clean 8 | all: exec $(obj) 9 | 10 | clean: 11 | rm -f $(obj) 12 | 13 | exec: $(obj) 14 | $(CXX) $(obj) $(LDFLAGS) 15 | 16 | %.o: %.cc 17 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ 18 | -------------------------------------------------------------------------------- /bin/cpp_src/webgl-header.cc: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview A single step in a WebGL application. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | #include "webgl-shared.h" 15 | -------------------------------------------------------------------------------- /bin/save-trace.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | fs = require('fs'); 4 | http = require('http'); 5 | os = require('os'); 6 | optimist = require('optimist'); 7 | 8 | main(optimist.default('port', 8000).argv); 9 | 10 | function main(argv) { 11 | hostname = os.hostname(); 12 | port = argv.port; 13 | console.log('Run this command from your JavaScript console:'); 14 | console.log('> wtf.trace.snapshot("http://%s:%s")', hostname, port); 15 | http.createServer(requestListener).listen(port, hostname); 16 | } 17 | 18 | function requestListener(req, res) { 19 | if (req.method == 'OPTIONS') 20 | handleOptions(req, res); 21 | else if (req.method == 'POST') 22 | handlePost(req, res); 23 | else 24 | handleDefault(req, res); 25 | } 26 | 27 | function handleDefault(req, res) { 28 | res.statusCode = 404; 29 | res.end(); 30 | } 31 | 32 | // Save the posted trace file to local directory. 33 | function handlePost(req, res) { 34 | var length = parseInt(req.headers['content-length'], 10); 35 | if (length <= 0) { 36 | res.end(); 37 | return; 38 | } 39 | 40 | var filename = req.headers['x-filename'] || 'save-trace.wtf-trace'; 41 | var writable = fs.createWriteStream(filename, {flags: 'w'}); 42 | 43 | req.on('data', function(chunk) { 44 | writable.write(chunk); 45 | }); 46 | 47 | req.on('end', function() { 48 | console.log(filename); 49 | writable.end(); 50 | res.end(); 51 | }); 52 | } 53 | 54 | // Echo CORS headers. 55 | function handleOptions(req, res) { 56 | var acrh = req.headers['access-control-request-headers']; 57 | var origin = req.headers['origin']; 58 | if (acrh) res.setHeader('Access-Control-Allow-Headers', acrh); 59 | if (origin) res.setHeader('Access-Control-Allow-Origin', origin); 60 | res.end(); 61 | } 62 | -------------------------------------------------------------------------------- /bindings/cpp/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | *.so 4 | *_test 5 | tmp*.wtf-trace 6 | -------------------------------------------------------------------------------- /bindings/cpp/include/wtf/config.h: -------------------------------------------------------------------------------- 1 | #ifndef TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_CONFIG_H_ 2 | #define TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_CONFIG_H_ 3 | 4 | namespace wtf { 5 | 6 | // Whether default WTF tracing is enabled. Conditioned on the WTF_ENABLE 7 | // define. This impacts default template instantiations. Macros will use 8 | // a namespace specific kWtfEnabledForNamespace const. 9 | #if defined(WTF_ENABLE) 10 | constexpr bool kMasterEnable = true; 11 | #else 12 | constexpr bool kMasterEnable = false; 13 | #endif 14 | 15 | } // namespace wtf 16 | 17 | // Whether WTF is enabled for a namespace. Macros condition based on this, 18 | // which if undefined for a namespace, defaults to this global. 19 | constexpr bool kWtfEnabledForNamespace = ::wtf::kMasterEnable; 20 | 21 | #endif // TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_CONFIG_H_ 22 | -------------------------------------------------------------------------------- /bindings/cpp/include/wtf/platform/README.md: -------------------------------------------------------------------------------- 1 | ## Platform Specific Support 2 | 3 | The top level platform.h will select and include both an underlying 4 | platform implementation and a threading model. 5 | 6 | Supported platforms: 7 | 8 | * myriad2sparc: Myriad 2 SPARC cores. 9 | * myriad2shave: (TODO) Myriad 2 SHAVE cores. 10 | * default: Standard platform using generic library calls. 11 | 12 | TODO: The "default" platform has several POSIX-isms in it that should be 13 | disposed of in favor of C++ standard library calls. 14 | 15 | Threading models: 16 | 17 | * pthreads_threaded (default): Uses pthreads threading library. 18 | * std_threaded: Uses C++ std threading library. 19 | * single_threaded: Uses dummy threading constructs. 20 | 21 | Platforms can force a single threaded model, or it is selectable via 22 | the WTF_SINGLE_THREADED define. 23 | -------------------------------------------------------------------------------- /bindings/cpp/include/wtf/platform/platform_aux_pthreads_threaded_inl.h: -------------------------------------------------------------------------------- 1 | // Provides the PlatformGetThreadLocalEventBuffer() function by using 2 | // pthread keys. This should work for all POSIX platforms. 3 | #ifndef TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_AUX_PTHREADS_THREADED_INL_H_ 4 | #define TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_AUX_PTHREADS_THREADED_INL_H_ 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | namespace wtf { 12 | 13 | // On this platform, use the standard-library versions of atomics and mutexes. 14 | namespace platform { 15 | using mutex = std::mutex; 16 | 17 | template 18 | using lock_guard = std::lock_guard; 19 | 20 | template 21 | using atomic = std::atomic; 22 | 23 | // Since memory_order is an old-school enum, it needs to be imported 24 | // individually. 25 | using std::memory_order; 26 | using std::memory_order_acq_rel; 27 | using std::memory_order_acquire; 28 | using std::memory_order_consume; 29 | using std::memory_order_relaxed; 30 | using std::memory_order_release; 31 | using std::memory_order_seq_cst; 32 | 33 | using once_flag = struct { pthread_once_t flag{PTHREAD_ONCE_INIT}; }; 34 | 35 | template 36 | inline void call_once(once_flag& once, T func) { 37 | pthread_once(&once.flag, func); 38 | } 39 | 40 | } // namespace platform 41 | 42 | namespace internal { 43 | extern pthread_key_t event_buffer_key; 44 | extern pthread_once_t initialize_threading_once; 45 | 46 | void InitializeThreadingOnce(); 47 | 48 | } // namespace internal 49 | 50 | inline EventBuffer* PlatformGetThreadLocalEventBuffer() { 51 | pthread_once(&internal::initialize_threading_once, 52 | internal::InitializeThreadingOnce); 53 | return static_cast( 54 | pthread_getspecific(internal::event_buffer_key)); 55 | } 56 | 57 | } // namespace wtf 58 | 59 | #endif // TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_AUX_PTHREADS_THREADED_INL_H_ 60 | -------------------------------------------------------------------------------- /bindings/cpp/include/wtf/platform/platform_aux_single_threaded_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_SINGLE_THREADED_IMPL_H_ 2 | #define TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_SINGLE_THREADED_IMPL_H_ 3 | 4 | #include "wtf/buffer.h" 5 | 6 | namespace wtf { 7 | namespace internal { 8 | EventBuffer* event_buffer = nullptr; 9 | } // namespace internal 10 | 11 | void PlatformInitializeThreading() { 12 | static bool initialized = false; 13 | initialized = true; 14 | if (!initialized) { 15 | PlatformInitialize(); 16 | } 17 | } 18 | 19 | // There is only one buffer on this platform, since it is single-threaded. 20 | void PlatformSetThreadLocalEventBuffer(EventBuffer* new_event_buffer) { 21 | wtf::internal::event_buffer = new_event_buffer; 22 | } 23 | 24 | std::string PlatformGetThreadName() { return "Main"; } 25 | 26 | } // namespace wtf 27 | 28 | #endif // TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_SINGLE_THREADED_IMPL_H_ 29 | -------------------------------------------------------------------------------- /bindings/cpp/include/wtf/platform/platform_aux_single_threaded_inl.h: -------------------------------------------------------------------------------- 1 | #ifndef TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_AUX_SINGLE_THREADED_INL_H_ 2 | #define TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_AUX_SINGLE_THREADED_INL_H_ 3 | 4 | namespace wtf { 5 | 6 | // In this configuration, we provide skeletons of atomics and mutexes that 7 | // no-op. 8 | namespace platform { 9 | struct mutex {}; 10 | 11 | template 12 | struct lock_guard { 13 | ~lock_guard() {} 14 | 15 | T& mutex; 16 | }; 17 | 18 | enum memory_order { 19 | memory_order_relaxed, 20 | memory_order_consume, 21 | memory_order_acquire, 22 | memory_order_release, 23 | memory_order_acq_rel, 24 | memory_order_seq_cst 25 | }; 26 | 27 | template 28 | struct atomic { 29 | T value; 30 | 31 | T fetch_add(T increment) { 32 | value = value + increment; 33 | return value; 34 | } 35 | 36 | void store(T new_value, memory_order order = memory_order_seq_cst) { 37 | value = new_value; 38 | } 39 | T load(memory_order order = memory_order_seq_cst) { return value; } 40 | 41 | // Assignment conversion. 42 | void operator=(T& other) { value = other; } 43 | void operator=(const T& other) { value = other; } 44 | 45 | // Implicit cast to T. 46 | operator T() { return value; } 47 | }; 48 | 49 | using once_flag = struct { bool flag{false}; }; 50 | template 51 | inline void call_once(once_flag& once, T func) { 52 | if (!once.flag) { 53 | once.flag = true; 54 | func(); 55 | } 56 | } 57 | 58 | } // namespace platform 59 | 60 | namespace internal { 61 | extern EventBuffer* event_buffer; 62 | } // namespace internal 63 | 64 | inline EventBuffer* PlatformGetThreadLocalEventBuffer() { 65 | return internal::event_buffer; 66 | } 67 | 68 | } // namespace wtf 69 | 70 | #endif // TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_AUX_SINGLE_THREADED_INL_H_ 71 | -------------------------------------------------------------------------------- /bindings/cpp/include/wtf/platform/platform_aux_std_threaded_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_AUX_STD_THREADED_IMPL_H_ 2 | #define TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_AUX_STD_THREADED_IMPL_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include "wtf/buffer.h" 8 | 9 | namespace wtf { 10 | 11 | std::once_flag initialize_once_; 12 | 13 | thread_local struct ThreadLocalStorage { 14 | ThreadLocalStorage() = default; 15 | ~ThreadLocalStorage() { 16 | if (event_buffer) { 17 | event_buffer->MarkOutOfScope(); 18 | } 19 | } 20 | 21 | EventBuffer* event_buffer = nullptr; 22 | } storage_; 23 | 24 | EventBuffer* PlatformGetThreadLocalEventBuffer() { 25 | return storage_.event_buffer; 26 | } 27 | 28 | void PlatformInitializeThreading() { 29 | std::call_once(initialize_once_, PlatformInitialize); 30 | } 31 | 32 | void PlatformSetThreadLocalEventBuffer(EventBuffer* event_buffer) { 33 | std::call_once(initialize_once_, PlatformInitialize); 34 | storage_.event_buffer = event_buffer; 35 | } 36 | 37 | std::string PlatformGetThreadName() { 38 | // Note: Many platforms have richer APIs for getting friendly thread 39 | // names. Feel free to add platform specific conditionals prior to this 40 | // fallback. 41 | return std::to_string( 42 | std::hash{}(std::this_thread::get_id())); 43 | } 44 | 45 | } // namespace wtf 46 | 47 | #endif // TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_AUX_STD_THREADED_IMPL_H_ 48 | -------------------------------------------------------------------------------- /bindings/cpp/include/wtf/platform/platform_aux_std_threaded_inl.h: -------------------------------------------------------------------------------- 1 | // Provides the PlatformGetThreadLocalEventBuffer() function by using 2 | // C++11 thread_local variables. Should work on most modern platforms (besides 3 | // iOS). 4 | #ifndef TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_AUX_STD_THREADED_INL_H_ 5 | #define TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_AUX_STD_THREADED_INL_H_ 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | namespace wtf { 12 | 13 | // On this platform, use the standard-library versions of atomics and mutexes. 14 | namespace platform { 15 | using mutex = std::mutex; 16 | 17 | template 18 | using lock_guard = std::lock_guard; 19 | 20 | template 21 | using atomic = std::atomic; 22 | 23 | using once_flag = std::once_flag; 24 | template 25 | inline void call_once(once_flag& flag, Callable&& f) { 26 | std::call_once(flag, std::move(f)); 27 | } 28 | 29 | // Since memory_order is an old-school enum, it needs to be imported 30 | // individually. 31 | using std::memory_order; 32 | using std::memory_order_acq_rel; 33 | using std::memory_order_acquire; 34 | using std::memory_order_consume; 35 | using std::memory_order_relaxed; 36 | using std::memory_order_release; 37 | using std::memory_order_seq_cst; 38 | } // namespace platform 39 | 40 | EventBuffer* PlatformGetThreadLocalEventBuffer(); 41 | 42 | } // namespace wtf 43 | 44 | #endif // TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_AUX_STD_THREADED_INL_H_ 45 | -------------------------------------------------------------------------------- /bindings/cpp/include/wtf/platform/platform_default_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_DEFAULT_IMPL_H_ 2 | #define TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_DEFAULT_IMPL_H_ 3 | 4 | #include "wtf/buffer.h" 5 | 6 | namespace wtf { 7 | 8 | namespace internal { 9 | uint64_t base_timestamp_nanos = 0; 10 | } // namespace internal 11 | 12 | void PlatformInitialize() { 13 | internal::base_timestamp_nanos = internal::GetNanoTime(); 14 | } 15 | 16 | } // namespace wtf 17 | 18 | #endif // TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_DEFAULT_IMPL_H_ 19 | -------------------------------------------------------------------------------- /bindings/cpp/include/wtf/platform/platform_default_inl.h: -------------------------------------------------------------------------------- 1 | #ifndef TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_DEFAULT_INL_H_ 2 | #define TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_DEFAULT_INL_H_ 3 | 4 | #include 5 | 6 | namespace wtf { 7 | 8 | namespace internal { 9 | extern uint64_t base_timestamp_nanos; 10 | 11 | inline uint64_t GetNanoTime() { 12 | auto duration = std::chrono::steady_clock::now().time_since_epoch(); 13 | return std::chrono::duration_cast(duration).count(); 14 | } 15 | 16 | } // namespace internal 17 | 18 | inline uint32_t PlatformGetTimestampMicros32() { 19 | return (internal::GetNanoTime() - internal::base_timestamp_nanos) / 1000; 20 | } 21 | 22 | } // namespace wtf 23 | 24 | #endif // TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_DEFAULT_INL_H_ 25 | -------------------------------------------------------------------------------- /bindings/cpp/include/wtf/platform/platform_myriad2sparc_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_MYRIAD2SPARC_IMPL_H_ 2 | #define TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_MYRIAD2SPARC_IMPL_H_ 3 | 4 | #include 5 | 6 | #include "wtf/buffer.h" 7 | 8 | namespace wtf { 9 | 10 | namespace internal { 11 | uint64_t base_ticks = 0; 12 | uint64_t sysclks_per_us = 1; // Avoid divide by zero. 13 | } // namespace internal 14 | 15 | void PlatformInitialize() { 16 | // Initialize timer. 17 | // TODO(laurenzo): This does not support a changing clock speed. Fall back 18 | // to POSIX time if this is an issue. 19 | internal::base_ticks = internal::PlatformGetTickCount64(); 20 | internal::sysclks_per_us = DrvCprGetSysClocksPerUs(); 21 | if (internal::sysclks_per_us == 0) { 22 | // Avoid divide by zero. 23 | internal::sysclks_per_us = 1; 24 | } 25 | } 26 | 27 | } // namespace wtf 28 | 29 | #endif // TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_MYRIAD2_SPARC_IMPL_H_ 30 | -------------------------------------------------------------------------------- /bindings/cpp/include/wtf/platform/platform_myriad2sparc_inl.h: -------------------------------------------------------------------------------- 1 | // The Myriad platform minimally works with one core using the default 2 | // platform support, but this implementation is provided for the following 3 | // reasons: 4 | // - The cycle timer is lower overhead and more precise than the Posix 5 | // time APIs. 6 | // - This implementation can be extended to support tracing buffers on 7 | // SHAVEs. 8 | #ifndef TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_MYRIAD2SPARC_INL_H_ 9 | #define TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_MYRIAD2SPARC_INL_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace wtf { 16 | 17 | namespace internal { 18 | extern uint64_t base_ticks; 19 | extern uint64_t sysclks_per_us; 20 | 21 | __attribute__((always_inline)) inline uint64_t PlatformGetTickCount64() { 22 | // TODO(laurenzo): Detect core and use an appropriate timer. This is only 23 | // valid for LOS. 24 | // Note that the first read latches the second. There is a small hazzard of 25 | // error if pre-empted between these two but we ignore it for the sake of 26 | // expediency. 27 | // TODO(laurenzo): The datasheet is silent on the point, but a 64 bit load 28 | // would likely satisfy the constraints of the hardware and avoid the hazzard. 29 | uint32_t upper = GET_REG_WORD_VAL(TIM0_BASE_ADR + TIM_FREE_CNT1_OFFSET); 30 | uint32_t lower = GET_REG_WORD_VAL(TIM0_BASE_ADR + TIM_FREE_CNT0_OFFSET); 31 | 32 | return (static_cast(upper) << 32) | static_cast(lower); 33 | } 34 | 35 | } // namespace internal 36 | 37 | __attribute__((always_inline)) inline uint32_t PlatformGetTimestampMicros32() { 38 | uint64_t ticks = internal::PlatformGetTickCount64() - internal::base_ticks; 39 | return static_cast(ticks / internal::sysclks_per_us); 40 | } 41 | 42 | } // namespace wtf 43 | 44 | #endif // TRACING_FRAMEWORK_BINDINGS_CPP_INCLUDE_WTF_PLATFORM_MYRIAD2SPARC_INL_H_ 45 | -------------------------------------------------------------------------------- /bindings/cpp/platform.cc: -------------------------------------------------------------------------------- 1 | #include "wtf/platform.h" 2 | 3 | // Branch to for specific platform implementations. 4 | #if defined(__myriad__) && defined(__sparc__) 5 | #include "wtf/platform/platform_myriad2sparc_impl.h" 6 | #else 7 | // Default POSIX platform. 8 | #include "wtf/platform/platform_default_impl.h" 9 | #endif 10 | 11 | // Select threading library. 12 | #if defined(WTF_SINGLE_THREADED) 13 | #include "wtf/platform/platform_aux_single_threaded_impl.h" 14 | #elif defined(WTF_PTHREAD_THREADED) 15 | #include "wtf/platform/platform_aux_pthreads_threaded_impl.h" 16 | #else 17 | #include "wtf/platform/platform_aux_std_threaded_impl.h" 18 | #endif 19 | -------------------------------------------------------------------------------- /bindings/cpp/scripts/run_clang_format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | td="$(dirname $0)" 4 | sd="$td/.." 5 | 6 | clang-format -style=file -i \ 7 | $(find $sd -name '*.h') \ 8 | $(find $sd -name '*.cc') 9 | -------------------------------------------------------------------------------- /docs/memory_tracing.md: -------------------------------------------------------------------------------- 1 | # Memory Tracing 2 | 3 | (TODO: more docs) 4 | 5 | You must launch a Chrome with natives enabled. 6 | 7 | ```bash 8 | # WARNING: THIS IS TOTALLY UNSAFE! DO NOT BROWSE THE WEB LIKE THIS! 9 | chrome --disable-web-security --js-flags=--allow-natives-syntax 10 | ``` 11 | -------------------------------------------------------------------------------- /docs/node.md: -------------------------------------------------------------------------------- 1 | # Using the tracing-framework with node.js 2 | 3 | ## Tracing node applications 4 | 5 | ### Quickstart 6 | 7 | ```bash 8 | $ npm install tracing-framework 9 | $ node 10 | > var wtf = require('tracing-framework'); 11 | > wtf.trace.node.start(); 12 | > var scope = wtf.trace.enterScope('hello!'); 13 | > wtf.trace.leaveScope(scope); 14 | > process.exit() 15 | $ wtf-dump node-[time].wtf-trace 16 | ``` 17 | 18 | ### Instrumenting 19 | 20 | See [api](api.md) for the `wtf.trace` API. 21 | 22 | ### Running 23 | 24 | Automatic injection from the shell: 25 | 26 | ```bash 27 | # Start a snapshot-on-exit trace: 28 | wtf-trace myscript.js [args] 29 | ``` 30 | 31 | Simple snapshot-on-exit: 32 | 33 | var wtf = require('tracing-framework'); 34 | // Begin recording a trace - a snapshot will be taken upon process.exit. 35 | wtf.trace.node.start({ 36 | // Any options overrides; see options.md 37 | }); 38 | 39 | Manual control: 40 | 41 | var wtf = require('tracing-framework'); 42 | 43 | // Begin recording a trace... 44 | wtf.trace.prepare({ 45 | // Options 46 | }); 47 | wtf.trace.start(); 48 | 49 | // Perform a snapshot. 50 | wtf.trace.snapshot(); 51 | 52 | // Stop recording. 53 | wtf.trace.stop(); 54 | 55 | ## Loading and processing traces 56 | 57 | ### Quickstart 58 | 59 | ```bash 60 | $ npm install tracing-framework 61 | $ node 62 | > var wtf = require('tracing-framework'); 63 | > var db = wtf.db.load('test.wtf-trace', function(db) { 64 | db.query('something'); 65 | }); 66 | ``` 67 | 68 | ### Using the Tool Runner 69 | 70 | TODO 71 | -------------------------------------------------------------------------------- /docs/overhead.md: -------------------------------------------------------------------------------- 1 | # Tracing Overhead 2 | 3 | TODO(benvanik): more information 4 | 5 | ## Measured Overhead 6 | 7 | Every machine/browser/operating system has a different amount of overhead when 8 | tracing. Use the 'View Warnings' dialog in the WTF app to see information about 9 | the measured overhead from the machine that traced the file. 10 | 11 | The simplest WTF event takes about 0.1µs (that's 0.0001ms) on a decently fast 12 | Linux machine. A scope is made up of both an enter and a leave, each taking 13 | 0.1µs, so you can assume they take about 0.2-0.3µs together. 14 | 15 | Once you add arguments to events the time starts increasing. Arguments like 16 | `uint32` are cheap, others like `float32` and `ascii` are a bit more expensive, 17 | and some like `any` are very expensive. Use the strictest argument type you can 18 | and only trace what you need. 19 | 20 | Some events, like the generic `wtf.trace.enterScope`, 21 | `wtf.trace.appendScopeData`, and `wtf.trace.timeStamp` are horrendously 22 | expensive and should only be used when absolutely necessary. You should always 23 | be using typed events via `wtf.trace.events.create*` or the automatic 24 | instrumention functions like `wtf.trace.instrument`. 25 | 26 | ## Guidelines 27 | 28 | * Trace fewer than 10,000 scopes per frame. That's about 2ms of overhead. 29 | * Never use `enterScope`, `appendScopeData`, or `timeStamp`. 30 | * Never use the `any` event argument type. 31 | * Prefer the `ascii` event argument type to `utf8` which can be up to 2x slower. 32 | * Avoid large strings as `ascii` or `utf8` event arguments. 33 | * Avoid arrays as event arguments where non-arrays work (x,y,z vs. []). 34 | 35 | ## Benchmarks 36 | 37 | TODO(benvanik): post a public benchmark page. 38 | 39 | ## Warning Information 40 | 41 | 42 | ### Too Many Events Per Frame 43 | 44 | TODO(benvanik): document this 45 | -------------------------------------------------------------------------------- /docs/quickstarts.md: -------------------------------------------------------------------------------- 1 | # Quickstarts 2 | 3 | TODO(benvanik): add some quickstarts! 4 | -------------------------------------------------------------------------------- /docs/style_guide.md: -------------------------------------------------------------------------------- 1 | # Style Guide 2 | 3 | ## JavaScript 4 | 5 | Two documents of interest: 6 | 7 | * [Google JavaScript Style Guide](https://google.github.io/styleguide/javascriptguide.xml) 8 | * [Annotating JavaScript for the Closure Compiler](https://developers.google.com/closure/compiler/docs/js-for-compiler) 9 | 10 | Settings for your editor: 11 | 12 | * 80 columns max 13 | * 2-space indents, not tabs 14 | * No trailing whitespace, no extraneous linefeeds 15 | * Newline at end of file 16 | 17 | ### Linting 18 | 19 | Use the [Closure linter](https://developers.google.com/closure/utilities/) to lint and automatically fix some errors (of certain 20 | types). 21 | 22 | # Fix regular errors (missing goog.require/provide, etc) 23 | anvil build :fixstyle 24 | 25 | # Run full lint 26 | anvil build :lint 27 | -------------------------------------------------------------------------------- /docs/wtf-calls.md: -------------------------------------------------------------------------------- 1 | # wtf-calls File Format 2 | 3 | ## Structure 4 | 5 | All values in little-endian. 6 | 7 | ``` 8 | 4b header length = HL 9 | HL utf8-encoded JSON header 10 | [padding to align to 4b] 11 | * repeated 4b values indicating function 12 | ``` 13 | 14 | ## Header 15 | 16 | The header currently contains a map of modules by module ID. Module IDs are 17 | randomly assigned and are just used for differentiation. 18 | 19 | Each module contains a list of its function types and the range of the function 20 | in the unmodified source document. This can be used to look up function code 21 | either in the source file or through the source map. 22 | 23 | Functions are assigned IDs that should be treated as opaque. Function IDs will 24 | change on each recording, and cannot be correlated across files. Instead, use 25 | the function name and range to match functions. 26 | 27 | ``` 28 | { 29 | "version": 1, 30 | "context": { 31 | "uri": "http://...", 32 | "title": "Some Title" 33 | }, 34 | "metadata": { 35 | # 36 | }, 37 | "modules": { 38 | 0: { 39 | "src": "http://.....", 40 | "fns": [ 41 | [function id], [function name], [start range], [end range], 42 | ... 43 | ] 44 | } 45 | } 46 | } 47 | ``` 48 | 49 | ## Calls 50 | 51 | Calls in the file are paired enter-exits, similar to scopes in the WTF format. 52 | Enters are the function ID being entered, and exits are the negative of the 53 | function ID. Each ID is 4b. 54 | 55 | For example: 56 | 57 | ``` 58 | 1000 # enter function 1000 59 | 1001 # enter function 1001 60 | -1001 # leave function 1001 61 | -1000 # leave function 1000 62 | ``` 63 | -------------------------------------------------------------------------------- /extensions/wtf-injector-chrome/assets/icons/pageAction19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-chrome/assets/icons/pageAction19.png -------------------------------------------------------------------------------- /extensions/wtf-injector-chrome/assets/icons/pageAction19.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-chrome/assets/icons/pageAction19.psd -------------------------------------------------------------------------------- /extensions/wtf-injector-chrome/assets/icons/pageAction38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-chrome/assets/icons/pageAction38.png -------------------------------------------------------------------------------- /extensions/wtf-injector-chrome/assets/icons/pageAction38.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-chrome/assets/icons/pageAction38.psd -------------------------------------------------------------------------------- /extensions/wtf-injector-chrome/assets/icons/pageActionDisabled19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-chrome/assets/icons/pageActionDisabled19.png -------------------------------------------------------------------------------- /extensions/wtf-injector-chrome/assets/icons/pageActionDisabled38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-chrome/assets/icons/pageActionDisabled38.png -------------------------------------------------------------------------------- /extensions/wtf-injector-chrome/assets/icons/pageActionEnabled19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-chrome/assets/icons/pageActionEnabled19.png -------------------------------------------------------------------------------- /extensions/wtf-injector-chrome/assets/icons/pageActionEnabled38.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-chrome/assets/icons/pageActionEnabled38.png -------------------------------------------------------------------------------- /extensions/wtf-injector-chrome/assets/icons/wtf-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-chrome/assets/icons/wtf-128.png -------------------------------------------------------------------------------- /extensions/wtf-injector-chrome/assets/icons/wtf-128.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-chrome/assets/icons/wtf-128.psd -------------------------------------------------------------------------------- /extensions/wtf-injector-chrome/assets/icons/wtf-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-chrome/assets/icons/wtf-16.png -------------------------------------------------------------------------------- /extensions/wtf-injector-chrome/assets/icons/wtf-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-chrome/assets/icons/wtf-32.png -------------------------------------------------------------------------------- /extensions/wtf-injector-chrome/assets/icons/wtf-32.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-chrome/assets/icons/wtf-32.psd -------------------------------------------------------------------------------- /extensions/wtf-injector-chrome/assets/icons/wtf-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-chrome/assets/icons/wtf-48.png -------------------------------------------------------------------------------- /extensions/wtf-injector-chrome/background.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Chrome extension background page. 10 | * Entry point for the extension, setting up all browser UI bits and 11 | * coordinating the various pieces. 12 | * 13 | * @author benvanik@google.com (Ben Vanik) 14 | */ 15 | 16 | 17 | var _gaq = _gaq || []; 18 | _gaq.push(['_setAccount', 'UA-37275478-1']); 19 | _gaq.push(['_setSessionCookieTimeout', 0]); 20 | _gaq.push(['_trackPageview', '/background']); 21 | 22 | (function() { 23 | var ga = document.createElement('script'); 24 | ga.type = 'text/javascript'; 25 | ga.async = false; 26 | ga.src = 'https://ssl.google-analytics.com/ga.js'; 27 | var s = document.getElementsByTagName('script')[0]; 28 | s.parentNode.insertBefore(ga, s); 29 | })(); 30 | 31 | 32 | // main() 33 | var extension = new Extension(); 34 | extension.setup(); 35 | -------------------------------------------------------------------------------- /extensions/wtf-injector-firefox/BUILD.anvil: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Google Inc. All Rights Reserved. 2 | 3 | __author__ = 'benvanik@google.com (Ben Vanik)' 4 | 5 | 6 | # Firefox injector extension release output 7 | 8 | 9 | # ------------------------------------------------------------------------------ 10 | # Extension 11 | # ------------------------------------------------------------------------------ 12 | 13 | # Files relating to the injected tracing code 14 | copy_files( 15 | name='tracing_files', 16 | srcs=[ 17 | '../..:wtf_trace_web_js_compiled', 18 | ], 19 | out='data/') 20 | 21 | file_set( 22 | name='extension_files', 23 | srcs=[ 24 | ':tracing_files', 25 | 'data:files', 26 | 'icon.png', 27 | 'package.json', 28 | 'README.md', 29 | ] + 30 | glob('lib/**/*.js') + 31 | glob('data/**/*.*'), 32 | src_exclude_filter='*-deps.js|*.less|*.anvil') 33 | 34 | copy_files( 35 | name='deploy', 36 | srcs=[':extension_files'], 37 | out='../../wtf-injector-firefox/', 38 | flatten_paths=['extensions/wtf-injector-firefox/']) 39 | 40 | archive_files( 41 | name='wtf-injector-firefox', 42 | srcs=':extension_files', 43 | flatten_paths=['extensions/wtf-injector-firefox/']) 44 | -------------------------------------------------------------------------------- /extensions/wtf-injector-firefox/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-firefox/README.md -------------------------------------------------------------------------------- /extensions/wtf-injector-firefox/data/BUILD.anvil: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Google Inc. All Rights Reserved. 2 | 3 | __author__ = 'benvanik@google.com (Ben Vanik)' 4 | 5 | 6 | # Firefox injector extension data output 7 | 8 | 9 | file_set( 10 | name='all_less', 11 | srcs=glob('../../../src/**/*.less')) 12 | less_css_library( 13 | name='styles', 14 | srcs=[ 15 | 'widget-panel.less', 16 | ':all_less', 17 | ], 18 | include_paths=['src',], 19 | compiler_flags=[ 20 | #'--compress' 21 | ]) 22 | 23 | file_set( 24 | name='files', 25 | srcs=[ 26 | ':styles' 27 | ]) 28 | -------------------------------------------------------------------------------- /extensions/wtf-injector-firefox/data/assets/icons/wtf-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-firefox/data/assets/icons/wtf-32.png -------------------------------------------------------------------------------- /extensions/wtf-injector-firefox/data/assets/icons/wtf-on-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-firefox/data/assets/icons/wtf-on-32.png -------------------------------------------------------------------------------- /extensions/wtf-injector-firefox/data/widget-panel.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 13 |
14 | Show UI 15 |
16 |
17 | Reset Settings For This URL 18 |
19 | Enable For This URL 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /extensions/wtf-injector-firefox/data/widget-panel.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Firefox extension widget panel. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | 15 | var buttonToggle = document.querySelector('.buttonToggleInjector'); 16 | buttonToggle.onclick = function(e) { 17 | e.preventDefault(); 18 | self.port.emit('perform', 'toggle'); 19 | }; 20 | 21 | 22 | var buttonReset = document.querySelector('.buttonResetSettings'); 23 | buttonReset.onclick = function(e) { 24 | e.preventDefault(); 25 | self.port.emit('perform', 'reset'); 26 | }; 27 | 28 | 29 | var buttonShowUi = document.querySelector('.buttonShowUi'); 30 | buttonShowUi.onclick = function(e) { 31 | e.preventDefault(); 32 | self.port.emit('perform', 'show_ui'); 33 | }; 34 | 35 | 36 | var currentState = null; 37 | self.port.on('show', function(state) { 38 | currentState = state; 39 | if (currentState && currentState['enabled']) { 40 | buttonToggle.innerHTML = 'Disable For This URL'; 41 | } else { 42 | buttonToggle.innerHTML = 'Enable For This URL'; 43 | } 44 | }); 45 | 46 | -------------------------------------------------------------------------------- /extensions/wtf-injector-firefox/data/widget-panel.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @author benvanik@google.com (Ben Vanik) 10 | */ 11 | 12 | @import "wtf/ui/styles/reset.less"; 13 | @import "wtf/ui/styles/css3.less"; 14 | @import "wtf/ui/styles/common.less"; 15 | @import "wtf/ui/styles/kennedy.less"; 16 | 17 | body { 18 | margin: 10px; 19 | overflow: hidden; 20 | white-space: nowrap; 21 | } 22 | 23 | .buttonBar { 24 | min-width: 280px; 25 | } 26 | 27 | .buttonToggleInjector {} 28 | .buttonResetSettings {} 29 | .buttonShowUi {} 30 | -------------------------------------------------------------------------------- /extensions/wtf-injector-firefox/data/widget.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /extensions/wtf-injector-firefox/data/widget.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Firefox extension widget. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | 15 | var icon = document.querySelector('.icon-wtf'); 16 | 17 | var currentState = null; 18 | self.port.on('update', function(state) { 19 | currentState = state; 20 | if (currentState && currentState['enabled']) { 21 | icon.src = 'assets/icons/wtf-on-32.png'; 22 | } else { 23 | icon.src = 'assets/icons/wtf-32.png'; 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /extensions/wtf-injector-firefox/doc/main.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-firefox/doc/main.md -------------------------------------------------------------------------------- /extensions/wtf-injector-firefox/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/google/tracing-framework/89ca6c25bae7c11d12409739b2ef707ed9afe6c2/extensions/wtf-injector-firefox/icon.png -------------------------------------------------------------------------------- /extensions/wtf-injector-firefox/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "web-tracing-framework", 3 | "fullName": "Web Tracing Framework", 4 | "id": "jid1-AdSGhlstK2V5ig", 5 | "version": "2015.7.15.1", 6 | "description": "Rich tools for instrumenting, analyzing, and visualizing web apps. Make your app jank-free at 60fps!", 7 | "author": "benvanik@google.com", 8 | "license": "BSD" 9 | } 10 | -------------------------------------------------------------------------------- /extensions/wtf-injector-firefox/test/test-main.js: -------------------------------------------------------------------------------- 1 | var main = require("./main"); 2 | 3 | exports["test main"] = function(assert) { 4 | assert.pass("Unit test running!"); 5 | }; 6 | 7 | exports["test main async"] = function(assert, done) { 8 | assert.pass("async Unit test running!"); 9 | done(); 10 | }; 11 | 12 | require("sdk/test").run(exports); 13 | -------------------------------------------------------------------------------- /extensions/wtf-instrument-proxy/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 2, 3 | "name": "WTF Instrumentation Proxy", 4 | "version": "1.0", 5 | "description": "Instrument stuff", 6 | "permissions": [ 7 | "webRequest", 8 | "webRequestBlocking", 9 | "" 10 | ], 11 | "background": { 12 | "scripts": [ 13 | "background.js" 14 | ], 15 | "persistent": true 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /externs/analytics.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Google Analytics externs. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | * @externs 13 | */ 14 | 15 | 16 | /** 17 | * @type {!Object} 18 | */ 19 | var _gaq; 20 | 21 | 22 | /** 23 | * @param {!Array.} args 24 | */ 25 | _gaq.push = function(args) {}; 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tracing-framework", 3 | "version": "2015.7.15-1", 4 | "description": "Web Tracing Framework instrumentation and analysis library.", 5 | "keywords": [ 6 | "javascript", 7 | "debugging", 8 | "tracing", 9 | "performance" 10 | ], 11 | "license": "BSD-3-Clause", 12 | "homepage": "https://google.github.io/tracing-framework", 13 | "bugs": "https://github.com/google/tracing-framework/issues", 14 | "repository": { 15 | "type": "git", 16 | "url": "http://github.com/google/tracing-framework.git" 17 | }, 18 | "engines": { 19 | "node": ">=0.8.14" 20 | }, 21 | "scripts": {}, 22 | "dependencies": { 23 | "falafel": "0.1.4", 24 | "mkdirp": "0.3.5", 25 | "optimist": "0.3.5", 26 | "ws": "0.4.25", 27 | "string-hash": "~1.1.0", 28 | "temporary": "0.0.7" 29 | }, 30 | "devDependencies": { 31 | "benchmark": "1.0.0", 32 | "chai": "1.2.0", 33 | "less": "1.4.2", 34 | "mocha": "1.4.2", 35 | "pegjs": "~0.7.0", 36 | "wd": "0.0.32" 37 | }, 38 | "optionalDependencies": { 39 | "microtime": "2.1.2" 40 | }, 41 | "files": [ 42 | "build-out/wtf_node_js_compiled.js", 43 | "bin/", 44 | "bin/cpp_src/", 45 | "docs/", 46 | "extensions/wtf-injector-chrome/wtf-process.js", 47 | "extensions/wtf-instrument-proxy/", 48 | "AUTHORS", 49 | "CONTRIBUTORS.md", 50 | "LICENSE" 51 | ], 52 | "main": "./build-out/wtf_node_js_compiled", 53 | "bin": { 54 | "wtf-controller": "./bin/controller.js", 55 | "wtf-diff": "./bin/diff.js", 56 | "wtf-dump": "./bin/dump.js", 57 | "wtf-generate-webgl-app": "./bin/generate-webgl-app.js", 58 | "wtf-instrument": "./bin/instrument.js", 59 | "wtf-query": "./bin/query.js", 60 | "wtf-trace": "./bin/trace-runner.js", 61 | "wtf-save-trace": "./bin/save-trace.js" 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /scripts/run-benchmarks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2012 Google Inc. All Rights Reserved. 4 | 5 | # Run benchmarks quickly. 6 | # This requires up-to-date deps files, produced by 'anvil build :deps'. 7 | # 8 | # If trying to test in an automated environment, prefer using the :test rule: 9 | # anvil build :test 10 | 11 | 12 | # Fast build and ensure test dependencies exist. 13 | ./third_party/anvil-build/anvil-local.sh build :wtf_node_js_compiled 14 | 15 | 16 | GREP="$1" 17 | if [ -z $GREP ]; then 18 | GREP="" 19 | echo "Running all benchmarks..." 20 | else 21 | echo "Running benchmarks matching '$GREP'..." 22 | fi 23 | 24 | TRACING="" 25 | #TRACING="--trace-hydrogen --trace-inlining" 26 | 27 | node $TRACING ./scripts/run-benchmarks.js $GREP 28 | -------------------------------------------------------------------------------- /scripts/run-tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2012 Google Inc. All Rights Reserved. 4 | 5 | # Run tests quickly. 6 | # This requires up-to-date deps files, produced by 'anvil build :deps'. 7 | # 8 | # If trying to test in an automated environment, prefer using the :test rule: 9 | # anvil build :test 10 | 11 | # This must currently run from the root of the repo 12 | # TODO(benvanik): make this runnable from anywhere (find git directory?) 13 | if [ ! -d ".git" ]; then 14 | echo "This script must be run from the root of the repository (the folder containing .git)" 15 | exit 1 16 | fi 17 | 18 | # Fast build and ensure test dependencies exist. 19 | ./third_party/anvil-build/anvil-local.sh build -j1 :test_external 20 | 21 | GREP="$1" 22 | if [ -z $GREP ]; then 23 | GREP="" 24 | echo "Running all tests..." 25 | else 26 | echo "Running tests matching '$GREP'..." 27 | fi 28 | 29 | find src/ -name *_test.js -print | xargs \ 30 | node_modules/mocha/bin/mocha \ 31 | --ui tdd \ 32 | --reporter dot \ 33 | --require src/wtf/bootstrap/mocha.js \ 34 | --grep "$GREP" \ 35 | --globals "mochaCompletionWaiter,wtf_util_global_cache,closure_uid_*" 36 | -------------------------------------------------------------------------------- /scripts/setup.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Copyright 2012 Google Inc. All Rights Reserved. 4 | REM 5 | REM wtf Windows setup script 6 | REM 7 | REM This script will install all dependencies to the system (that it can). 8 | REM The dependencies are all local. 9 | REM 10 | REM Requires: 11 | REM - Git 1.7.5+ 12 | REM - Python 2.7+ 13 | REM - Python easy_install: http://pypi.python.org/pypi/setuptools 14 | REM - node.js v0.6.10+ (containing npm) 15 | 16 | ECHO. 17 | REM ============================================================================ 18 | REM Check for Python/node/etc 19 | REM ============================================================================ 20 | ECHO Checking for dependencies... 21 | 22 | REM TODO(benvanik): check python/node versions 23 | 24 | ECHO WARNING: you need to make sure you have Python 2.6+ and node 0.8.4+! 25 | ECHO WARNING: attempting to install pip - install it yourself if it fails! 26 | 27 | easy_install pip 28 | 29 | ECHO. 30 | REM ============================================================================ 31 | REM Git submodules 32 | REM ============================================================================ 33 | ECHO Fetching submodules... 34 | 35 | git submodule init 36 | git submodule update 37 | 38 | ECHO. 39 | REM ============================================================================ 40 | REM Node modules 41 | REM ============================================================================ 42 | ECHO Installing node modules... 43 | 44 | npm install 45 | 46 | ECHO. 47 | REM ============================================================================ 48 | REM Anvil init 49 | REM ============================================================================ 50 | ECHO Setting up anvil-build environment... 51 | 52 | third_party\anvil-build\setup-local.bat 53 | 54 | ECHO. 55 | -------------------------------------------------------------------------------- /scripts/update-benchmarks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2012 Google Inc. All Rights Reserved. 4 | 5 | # Updates the benchmarks index file, used to select and run benchmarks. 6 | 7 | # This must currently run from the root of the repo 8 | # TODO(benvanik): make this runnable from anywhere (find git directory?) 9 | if [ ! -d ".git" ]; then 10 | echo "This script must be run from the root of the repository (the folder containing .git)" 11 | exit 1 12 | fi 13 | 14 | # TODO(benvanik): list *.js, see if it contains any benchmark.register() functions 15 | -------------------------------------------------------------------------------- /scripts/update-third-party.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2012 Google Inc. All Rights Reserved. 4 | 5 | # This script is only to be used by contributors. 6 | # It will attempt to pull the latest versions of third party code and binaries. 7 | # Before running one should be in a git branch with no pending changes. 8 | 9 | # This must currently run from the root of the repo 10 | # TODO(benvanik): make this runnable from anywhere (find git directory?) 11 | if [ ! -d ".git" ]; then 12 | echo "This script must be run from the root of the repository (the folder containing .git)" 13 | exit 1 14 | fi 15 | 16 | # ============================================================================= 17 | # Node modules 18 | # ============================================================================= 19 | 20 | npm install 21 | 22 | # ============================================================================= 23 | # Git submodules 24 | # ============================================================================= 25 | echo "Updating git modules..." 26 | 27 | # TODO(benvanik): update each module 28 | SUBMODULES=( anvil-build closure-compiler closure-library closure-linter closure-stylesheets closure-templates ) 29 | cd third_party 30 | for m in ${SUBMODULES[@]} 31 | do 32 | echo "-> third_party/$m" 33 | cd $m 34 | git checkout master 35 | git pull origin master 36 | git merge origin/master 37 | cd .. 38 | done 39 | cd .. 40 | for m in ${SUBMODULES[@]} 41 | do 42 | git add third_party/$m 43 | done 44 | 45 | echo "" 46 | -------------------------------------------------------------------------------- /src/wtf/addon/appaddon.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Instantiated app UI addon. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.addon.AppAddon'); 15 | 16 | goog.require('goog.asserts'); 17 | goog.require('wtf.events.EventEmitter'); 18 | 19 | 20 | 21 | /** 22 | * Abstract instantiated app UI addon. 23 | * This is a proxy for the actual addon, which is created inside of an iframe. 24 | * @param {!wtf.addon.Manifest} manifest Addon manifest. 25 | * @constructor 26 | * @extends {wtf.events.EventEmitter} 27 | */ 28 | wtf.addon.AppAddon = function(manifest) { 29 | goog.base(this); 30 | 31 | var info = manifest.getAppInfo(); 32 | goog.asserts.assert(info); 33 | 34 | /** 35 | * Manifest. 36 | * @type {!wtf.addon.Manifest} 37 | * @private 38 | */ 39 | this.manifest_ = manifest; 40 | 41 | /** 42 | * App info from the manifest. 43 | * @type {!wtf.addon.Manifest.AppInfo} 44 | * @private 45 | */ 46 | this.info_ = info; 47 | }; 48 | goog.inherits(wtf.addon.AppAddon, wtf.events.EventEmitter); 49 | 50 | 51 | /** 52 | * Gets the addon manifest. 53 | * @return {!wtf.addon.Manifest} Addon manifest. 54 | */ 55 | wtf.addon.AppAddon.prototype.getManifest = function() { 56 | return this.manifest_; 57 | }; 58 | 59 | 60 | /** 61 | * Gets the app information associated with the addon. 62 | * @return {!wtf.addon.Manifest.AppInfo} App information. 63 | */ 64 | wtf.addon.AppAddon.prototype.getInfo = function() { 65 | return this.info_; 66 | }; 67 | -------------------------------------------------------------------------------- /src/wtf/addon/traceaddon.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Instantiated trace addon. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.addon.TraceAddon'); 15 | 16 | goog.require('goog.asserts'); 17 | goog.require('wtf.events.EventEmitter'); 18 | 19 | 20 | 21 | /** 22 | * Tracing addon. 23 | * @param {!wtf.addon.Manifest} manifest Addon manifest. 24 | * @constructor 25 | * @extends {wtf.events.EventEmitter} 26 | */ 27 | wtf.addon.TraceAddon = function(manifest) { 28 | goog.base(this); 29 | 30 | var info = manifest.getTracingInfo(); 31 | goog.asserts.assert(info); 32 | 33 | /** 34 | * Manifest. 35 | * @type {!wtf.addon.Manifest} 36 | * @private 37 | */ 38 | this.manifest_ = manifest; 39 | 40 | /** 41 | * Tracing info from the manifest. 42 | * @type {!wtf.addon.Manifest.TracingInfo} 43 | * @private 44 | */ 45 | this.info_ = info; 46 | }; 47 | goog.inherits(wtf.addon.TraceAddon, wtf.events.EventEmitter); 48 | 49 | 50 | /** 51 | * Gets the addon manifest. 52 | * @return {!wtf.addon.Manifest} Addon manifest. 53 | */ 54 | wtf.addon.TraceAddon.prototype.getManifest = function() { 55 | return this.manifest_; 56 | }; 57 | 58 | 59 | /** 60 | * Gets the tracing information associated with the addon. 61 | * @return {!wtf.addon.Manifest.TracingInfo} Tracing information. 62 | */ 63 | wtf.addon.TraceAddon.prototype.getInfo = function() { 64 | return this.info_; 65 | }; 66 | -------------------------------------------------------------------------------- /src/wtf/app/app.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Main UI LESS file. 10 | * This is not designed to be used as a root, but instead should be referenced 11 | * by other LESS files that need any of the common styles/mixins or use any of 12 | * the wtf.ui controls. 13 | * 14 | * @author benvanik@google.com (Ben Vanik) 15 | */ 16 | 17 | @import "wtf/ui/styles/reset.less"; 18 | @import "wtf/ui/ui.less"; 19 | 20 | @import "wtf/app/documentview.less"; 21 | @import "wtf/app/healthdialog.less"; 22 | @import "wtf/app/helpdialog.less"; 23 | @import "wtf/app/maindisplay.less"; 24 | @import "wtf/app/splashdialog.less"; 25 | @import "wtf/app/statusbar.less"; 26 | @import "wtf/app/tabbar.less"; 27 | @import "wtf/app/toolbar.less"; 28 | 29 | @import "wtf/app/graphics/graphics.less"; 30 | @import "wtf/app/nav/nav.less"; 31 | @import "wtf/app/query/query.less"; 32 | @import "wtf/app/tracks/tracks.less"; 33 | 34 | // TODO(benvanik): move to its own file. 35 | @import "wtf/replay/timetravel/timetravel.less"; 36 | 37 | // Graphics replay. 38 | @import "wtf/replay/graphics/ui/graphics.less"; 39 | 40 | body { 41 | // Disable over-scroll bounce on the body. 42 | overflow: hidden; 43 | } 44 | -------------------------------------------------------------------------------- /src/wtf/app/documentview.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Document view CSS. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | @appUiDocumentViewToolbarHeight: 41px; 15 | @appUiDocumentViewStatusbarHeight: 29px; 16 | 17 | /* Document view root. */ 18 | .appUiDocumentView { 19 | .fitParent(); 20 | overflow: hidden; 21 | 22 | background: white; 23 | } 24 | 25 | .appUiDocumentViewToolbar { 26 | overflow: hidden; 27 | } 28 | 29 | .appUiDocumentViewInner { 30 | position: absolute; 31 | left: 0; 32 | right: 0; 33 | top: @appUiDocumentViewToolbarHeight; 34 | bottom: @appUiDocumentViewStatusbarHeight; 35 | overflow: hidden; 36 | } 37 | 38 | .appUiDocumentViewStatusbar { 39 | position: absolute; 40 | left: 0; 41 | right: 0; 42 | bottom: 0; 43 | height: @appUiDocumentViewStatusbarHeight; 44 | overflow: hidden; 45 | } 46 | -------------------------------------------------------------------------------- /src/wtf/app/documentview.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Document view DOM. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | {namespace wtf.app.documentview} 15 | 16 | 17 | /** 18 | * Root control UI. 19 | */ 20 | {template .control} 21 |
22 |
23 |
24 |
25 |
26 | {/template} 27 | -------------------------------------------------------------------------------- /src/wtf/app/exports.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Chrome UI API exports. 10 | * Exports the UI to external code. 11 | * 12 | * @author benvanik@google.com (Ben Vanik) 13 | */ 14 | 15 | goog.provide('wtf.app.exports'); 16 | 17 | /** @suppress {extraRequire} */ 18 | goog.require('goog.events.EventWrapper'); 19 | /** @suppress {extraRequire} */ 20 | goog.require('goog.vec.Vec3'); 21 | goog.require('wtf.app'); 22 | 23 | 24 | /** 25 | * @define {boolean} Whether to enable exporting of the wtf.ui 26 | * types and namespace. 27 | * 28 | * This should only be enabled in builds of the standalone library. If you're 29 | * including this code with it enabled in Closurized javascript then you'll 30 | * prevent renaming. 31 | */ 32 | wtf.app.exports.ENABLE_EXPORTS = false; 33 | 34 | 35 | if (wtf.app.exports.ENABLE_EXPORTS) { 36 | // wtf.app controls 37 | goog.exportSymbol( 38 | 'wtf.app.show', 39 | wtf.app.show); 40 | } 41 | -------------------------------------------------------------------------------- /src/wtf/app/granularity.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Granularity utilities. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.app.Granularity'); 15 | 16 | 17 | /** 18 | * Useful time granularities, in ms. 19 | * @enum {number} 20 | */ 21 | wtf.app.Granularity = { 22 | /** s */ 23 | SECOND: 1000, 24 | /** ds */ 25 | DECISECOND: 100, 26 | /** cs */ 27 | CENTISECOND: 10, 28 | /** ms */ 29 | MILLISECOND: 1, 30 | 31 | // TODO(benvanik): make this a setting on the summary index instead? 32 | /** 33 | * The finest granularity to work with. 34 | */ 35 | FINEST: 100 36 | }; 37 | -------------------------------------------------------------------------------- /src/wtf/app/graphics/canvaspanel.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * CanvasPanel CSS. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | /* CanvasPanel root. */ 15 | .appUiCanvasPanel { 16 | .fitParent(); 17 | } 18 | -------------------------------------------------------------------------------- /src/wtf/app/graphics/canvaspanel.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * CanvasPanel DOM. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | {namespace wtf.app.graphics.canvaspanel} 15 | 16 | 17 | /** 18 | * Root control UI. 19 | */ 20 | {template .control} 21 |
22 |
23 | {/template} 24 | -------------------------------------------------------------------------------- /src/wtf/app/graphics/graphics.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @author benvanik@google.com (Ben Vanik) 10 | */ 11 | 12 | @import "wtf/app/graphics/canvaspanel.less"; 13 | -------------------------------------------------------------------------------- /src/wtf/app/healthdialog.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Health dialog CSS. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | .appUiHealthDialog { 15 | width: 550px; 16 | height: 400px; 17 | margin: 10px; 18 | 19 | .listHeader { 20 | } 21 | .scrollArea { 22 | position: absolute; 23 | top: 100px; 24 | bottom: 10px; 25 | left: 10px; 26 | right: 10px; 27 | 28 | border: 1px solid #EBEBEB; 29 | 30 | padding: 5px; 31 | 32 | overflow-y: scroll; 33 | } 34 | .list { 35 | .allowSelect(); 36 | } 37 | 38 | .warningsList {} 39 | .offendersList {} 40 | 41 | .warning { 42 | margin-bottom: 5px; 43 | 44 | div { 45 | margin-bottom: 3px; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/wtf/app/healthdialog.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Health dialog DOM. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | {namespace wtf.app.healthdialog} 15 | 16 | 17 | /** 18 | * Root control UI. 19 | */ 20 | {template .control} 21 |
22 | Tracing has overhead. Learn more here.
23 |
24 | Estimated overhead/scope: (unavailable)
25 | Total estimated overhead: (unavailable)
26 |
27 |

Warnings:

28 |
29 |
30 |
31 |
32 | {/template} 33 | 34 | 35 | /** 36 | * An individual warning. 37 | * @param title Warning title. 38 | * @param suggestion Suggested action. 39 | * @param details Details like count/etc. 40 | * @param link Link to more information. 41 | */ 42 | {template .warning} 43 |
44 |
45 | 46 | {if $link} 47 | 48 | {/if} 49 | {$title} 50 | {if $link} 51 | 52 | {/if} 53 | 54 |
55 |
{$suggestion}
56 |
{$details}
57 |
58 | {/template} 59 | -------------------------------------------------------------------------------- /src/wtf/app/helpdialog.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Help dialog screen. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.app.HelpDialog'); 15 | 16 | goog.require('goog.soy'); 17 | goog.require('wtf'); 18 | goog.require('wtf.app.helpdialog'); 19 | goog.require('wtf.events.Keyboard'); 20 | goog.require('wtf.ui.Dialog'); 21 | goog.require('wtf.version'); 22 | 23 | 24 | 25 | /** 26 | * Help overlay screen. 27 | * 28 | * @param {!Element} parentElement Element to display in. 29 | * @param {goog.dom.DomHelper=} opt_dom DOM helper. 30 | * @constructor 31 | * @extends {wtf.ui.Dialog} 32 | */ 33 | wtf.app.HelpDialog = function(parentElement, opt_dom) { 34 | goog.base(this, { 35 | modal: true 36 | }, parentElement, opt_dom); 37 | }; 38 | goog.inherits(wtf.app.HelpDialog, wtf.ui.Dialog); 39 | 40 | 41 | /** 42 | * @override 43 | */ 44 | wtf.app.HelpDialog.prototype.createDom = function(dom) { 45 | return /** @type {!Element} */ (goog.soy.renderAsFragment( 46 | wtf.app.helpdialog.control, { 47 | version: wtf.version.toString(), 48 | version_commit: wtf.version.getCommit(), 49 | system_key: wtf.events.Keyboard.SYSTEM_KEY, 50 | is_chrome_extension: wtf.CHROME_EXTENSION 51 | }, undefined, dom)); 52 | }; 53 | -------------------------------------------------------------------------------- /src/wtf/app/helpdialog.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Help dialog CSS. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | .appUiHelpDialog { 15 | width: 800px; 16 | height: 400px; 17 | 18 | .header { 19 | .buttons { 20 | padding-top: 33px; 21 | } 22 | } 23 | 24 | .content { 25 | width: 100%; 26 | 27 | .info { 28 | margin: 10px; 29 | } 30 | 31 | .extension { 32 | margin: 10px; 33 | 34 | code { 35 | font-family: monospace; 36 | } 37 | } 38 | 39 | .columnOuter { 40 | width: 50%; 41 | float: left; 42 | .column { 43 | margin: 10px; 44 | } 45 | 46 | .keyGroup { 47 | margin-bottom: 5px; 48 | & .title { 49 | margin-left: 120px; 50 | font-weight: bold; 51 | } 52 | & .rows { 53 | & .row { 54 | line-height: 17px; 55 | .keys { 56 | width: 110px; 57 | margin-right: 10px; 58 | float: left; 59 | text-align: right; 60 | font-family: monospace; 61 | } 62 | } 63 | } 64 | } 65 | } 66 | } 67 | 68 | .footer { 69 | margin: 10px; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/wtf/app/maindisplay.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Main display CSS. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | /* MainDisplay. */ 15 | .appUiMainDisplay { 16 | .fitParent(); 17 | } 18 | 19 | /* Parent element of the main DocumentView. */ 20 | .appUiMainDocumentView { 21 | .fitParent(); 22 | 23 | min-width: 450px; 24 | overflow: hidden; 25 | } 26 | 27 | .appUiMainCenteredBlock { 28 | position: absolute; 29 | width: 100%; 30 | height: 100%; 31 | top: 50%; 32 | text-align: center; 33 | } 34 | -------------------------------------------------------------------------------- /src/wtf/app/maindisplay.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Main display DOM. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | {namespace wtf.app.maindisplay} 15 | 16 | 17 | /** 18 | * Root control UI. 19 | */ 20 | {template .control} 21 |
22 |
23 |
24 |
25 | {/template} 26 | -------------------------------------------------------------------------------- /src/wtf/app/nav/nav.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @author benvanik@google.com (Ben Vanik) 10 | */ 11 | 12 | @import "wtf/app/nav/navbar.less"; 13 | @import "wtf/app/nav/statsbox.less"; 14 | -------------------------------------------------------------------------------- /src/wtf/app/nav/navbar.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Navbar CSS. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | /* Navbar root. */ 15 | .appUiNavbar { 16 | @defaultHeight: 130px; 17 | @infoWidth: 300px; 18 | 19 | position: relative; 20 | left: 0; 21 | right: 0; 22 | top: 0; 23 | height: @defaultHeight; 24 | overflow: hidden; 25 | background: white; 26 | 27 | & .outer { 28 | position: absolute; 29 | left: 0; 30 | right: 0; 31 | height: 100%; 32 | margin-right: @infoWidth + 1; 33 | border-right: 1px solid #ebebeb; 34 | overflow: hidden; 35 | 36 | & .canvas { 37 | cursor: crosshair; 38 | } 39 | 40 | & .canvasOverlay { 41 | .fitParent(); 42 | pointer-events: none; 43 | overflow: hidden; 44 | margin-top: 16px; 45 | 46 | & .view { 47 | position: absolute; 48 | bottom: 0; 49 | top: 0; 50 | background-color: rgba(0,0,0,0.1); 51 | border-left: 1px solid #DDDDDD; 52 | border-right: 1px solid #DDDDDD; 53 | } 54 | } 55 | } 56 | 57 | & .boxesOuter { 58 | position: absolute; 59 | top: 0; 60 | bottom: 0; 61 | right: 0; 62 | width: @infoWidth; 63 | 64 | & .boxes { 65 | position: absolute; 66 | left: 0; 67 | right: 0; 68 | top: 0; 69 | bottom: 0; 70 | overflow-x: hidden; 71 | overflow-y: auto; 72 | } 73 | } 74 | 75 | & .navbarSplitter {} 76 | } 77 | -------------------------------------------------------------------------------- /src/wtf/app/nav/navbar.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Navbar DOM. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | {namespace wtf.app.nav.navbar} 15 | 16 | 17 | /** 18 | * Root control UI. 19 | */ 20 | {template .control} 21 |
22 |
23 | 24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | 32 |
33 | {/template} 34 | -------------------------------------------------------------------------------- /src/wtf/app/nav/statsbox.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Stats box CSS. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | /* Stats box root. */ 15 | .appUiNavbarStatsBox { 16 | @numbersWidth: 150px; 17 | @height: 65px; 18 | 19 | position: relative; 20 | height: @height - 1; 21 | border-bottom: 1px solid #DDDDDD; 22 | 23 | & .title { 24 | position: absolute; 25 | top: 2px; 26 | left: 2px; 27 | font-family: monospace; 28 | font-weight: bold; 29 | cursor: default; 30 | } 31 | 32 | .graphOuter { 33 | height: 100%; 34 | margin-right: @numbersWidth; 35 | overflow: hidden; 36 | cursor: default; 37 | 38 | & .graphCanvas { 39 | } 40 | & .todo { 41 | color: lightgray; 42 | position: absolute; 43 | top: 30px; 44 | left: 50px; 45 | } 46 | } 47 | 48 | .numbersOuter { 49 | position: absolute; 50 | top: 0; 51 | right: 0; 52 | width: @numbersWidth - 1; 53 | height: 100%; 54 | border-left: 1px solid #EEEEEE; 55 | 56 | & .numbersTable { 57 | width: 100%; 58 | margin: 3px; 59 | padding-top: 5px; 60 | 61 | td:first-child { 62 | width: 53px; 63 | /*width: 1%;*/ 64 | 65 | white-space: nowrap; 66 | text-align: right; 67 | padding-right: 5px; 68 | } 69 | td:last-child { 70 | /*width: 100%;*/ 71 | 72 | white-space: nowrap; 73 | } 74 | td { 75 | .allowSelect(); 76 | } 77 | } 78 | 79 | .empty { 80 | color: lightgray; 81 | cursor: default; 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/wtf/app/nav/statsbox.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Stats box DOM. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | {namespace wtf.app.nav.statsbox} 15 | 16 | 17 | /** 18 | * Root control UI. 19 | */ 20 | {template .control} 21 |
22 |
23 |
24 | 25 |
TODO
26 |
27 |
28 | 29 |
30 |
31 |
32 | {/template} 33 | -------------------------------------------------------------------------------- /src/wtf/app/query/query.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @author benvanik@google.com (Ben Vanik) 10 | */ 11 | 12 | @import "wtf/app/query/querypanel.less"; 13 | -------------------------------------------------------------------------------- /src/wtf/app/splashdialog.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Splash dialog CSS. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | .appUiSplashDialog { 15 | width: 400px; 16 | height: 200px; 17 | 18 | .header > h1 { 19 | padding-left: 0; 20 | font-weight: bold; 21 | text-align: center; 22 | } 23 | 24 | .kButtonBar { 25 | text-align: center; 26 | .kButton { 27 | float: none; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/wtf/app/splashdialog.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Splash dialog DOM. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | {namespace wtf.app.splashdialog} 15 | 16 | 17 | /** 18 | * Root control UI. 19 | * @param version Version string ('2012.12.12-1'). 20 | * @param version_commit Version git commit SHA. 21 | * @param system_key System command key string (like 'ctrl'). 22 | * @param show_drive Whether to show the open from drive button. 23 | */ 24 | {template .control} 25 |
26 | 29 |
30 | Drag-drop a .wtf-trace file into this window to load.
31 |
32 |
33 | Open 34 | {if $show_drive} 35 | Open (Drive) 36 | {/if} 37 |
38 |
39 |
40 | Version: {$version} / browse code / view latest changes
41 |
42 |
43 | {/template} 44 | -------------------------------------------------------------------------------- /src/wtf/app/statusbar.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Statusbar CSS. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | /* Statusbar root. */ 15 | .appUiStatusbar { 16 | .fitParent(); 17 | 18 | color: #777777; 19 | font-size: 12px; 20 | font-family: monospace; 21 | background: white; 22 | border-top: 1px solid #EBEBEB; 23 | 24 | padding-top: 7px; 25 | padding-left: 7px; 26 | padding-right: 7px; 27 | 28 | .left { 29 | float: left; 30 | div { 31 | float: left; 32 | } 33 | } 34 | .right { 35 | float: right; 36 | div { 37 | float: left; 38 | } 39 | } 40 | 41 | .selectionCounts { 42 | margin-right: 5px; 43 | width: 100px; 44 | text-align: center; 45 | } 46 | .selectionTimes { 47 | min-width: 200px; 48 | text-align: center; 49 | } 50 | .selectionControls { 51 | } 52 | 53 | .health { 54 | margin-right: 10px; 55 | .viewHealthLink {} 56 | } 57 | 58 | .timeTotals { 59 | margin-right: 5px; 60 | } 61 | .timeRange { 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/wtf/app/statusbar.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Statusbar DOM. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | {namespace wtf.app.statusbar} 15 | 16 | 17 | /** 18 | * Root control UI. 19 | * @param system_key System command key string (like 'ctrl'). 20 | */ 21 | {template .control} 22 |
23 |
24 |
26 |
27 |
29 |
30 |
31 | Select All 32 |  /  33 | Visible 34 |
35 |
36 |
37 |
38 | View Warnings 39 |
40 |
42 |
43 |
45 |
46 |
47 |
48 | {/template} 49 | -------------------------------------------------------------------------------- /src/wtf/app/tabbar.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Tabbar CSS. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | /* Tabbar root. */ 15 | .appUiTabbar { 16 | position: relative; 17 | left: 0; 18 | right: 0; 19 | bottom: 0; 20 | overflow: hidden; 21 | 22 | background: white; 23 | } 24 | -------------------------------------------------------------------------------- /src/wtf/app/tabbar.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Tabbar DOM. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | {namespace wtf.app.tabbar} 15 | 16 | 17 | /** 18 | * Root control UI. 19 | */ 20 | {template .control} 21 |
22 |
23 |
24 |
25 | 26 |
27 |
28 |
29 |
30 | {/template} 31 | -------------------------------------------------------------------------------- /src/wtf/app/tabpanel.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Shared panel CSS. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | .appUiTabPanel { 15 | .fitParent(); 16 | 17 | background-color: white; 18 | } 19 | 20 | .appUiTabPanel iframe { 21 | background-color: white; 22 | border: 0; 23 | padding: 0; 24 | overflow: hidden; 25 | } 26 | -------------------------------------------------------------------------------- /src/wtf/app/toolbar.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Toolbar CSS. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | /* Toolbar root. */ 15 | .appUiToolbar { 16 | height: 40px; 17 | 18 | background: white; 19 | 20 | border-bottom: 1px solid #EBEBEB; 21 | 22 | .leftPane { 23 | float: left; 24 | height: 100%; 25 | margin-top: 8px; 26 | 27 | .infoIcon { 28 | width: 16px; 29 | height: 16px; 30 | margin-left: 6px; 31 | position: relative; 32 | top: 2px; 33 | } 34 | .infoTitle { 35 | max-width: 300px; 36 | overflow: hidden; 37 | white-space: nowrap; 38 | text-overflow: ellipsis; 39 | font-size: 16px; 40 | color: #dd4b39; 41 | padding-left: 2px; 42 | padding-right: 6px; 43 | } 44 | .infoUrl { 45 | .allowSelect(); 46 | display: block; 47 | max-width: 200px; 48 | overflow: hidden; 49 | white-space: nowrap; 50 | text-overflow: ellipsis; 51 | height: 16px; 52 | } 53 | .infoContext { 54 | } 55 | } 56 | 57 | .healthPane { 58 | float: left; 59 | margin-top: 15px; 60 | height: 100%; 61 | left: 50%; 62 | right: 50%; 63 | 64 | .warning { 65 | font-weight: bold; 66 | } 67 | .viewHealthLink {} 68 | } 69 | 70 | .rightPane { 71 | position: relative; 72 | top: 6px; 73 | bottom: 6px; 74 | float: right; 75 | 76 | .viewers { 77 | float: left; 78 | margin-right: 6px; 79 | margin-top: 6px; 80 | font-size: 12px; 81 | color: #777777; 82 | } 83 | 84 | .buttons { 85 | float: left; 86 | 87 | .buttonOpen {} 88 | .buttonSave {} 89 | .buttonSettings {} 90 | .buttonHelp {} 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/wtf/app/tracks/trackinfobar.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * TracksPanel info bar CSS. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | .appUiTracksPanelInfo { 15 | position: absolute; 16 | top: 0; 17 | bottom: 0; 18 | right: 0; 19 | width: 300px; 20 | 21 | @headerHeight: 40px; 22 | & > .header { 23 | position: absolute; 24 | left: 0; 25 | right: 0; 26 | top: 0; 27 | height: @headerHeight - 6px; 28 | border-bottom: 1px solid #ebebeb; 29 | padding-left: 5px; 30 | padding-top: 5px; 31 | 32 | table { 33 | width: 100%; 34 | td { 35 | vertical-align: top; 36 | } 37 | td:last-child { 38 | width: 1%; 39 | } 40 | } 41 | 42 | .searchBox { 43 | padding-right: 5px; 44 | } 45 | .kSearchField { 46 | width: 100%; 47 | font-family: monospace; 48 | font-size: 11px; 49 | } 50 | 51 | .kButtonBar { 52 | margin-left: 6px; 53 | } 54 | } 55 | 56 | & > .content { 57 | position: absolute; 58 | left: -2px; 59 | right: 0; 60 | top: @headerHeight; 61 | bottom: 0; 62 | overflow: hidden; 63 | 64 | & .resultsOuter { 65 | position: absolute; 66 | width: 100%; 67 | top: 0; 68 | bottom: 0; 69 | 70 | overflow-x: hidden; 71 | overflow-y: auto; 72 | 73 | & .results { 74 | .fitParent(); 75 | 76 | cursor: pointer; 77 | } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/wtf/app/tracks/trackinfobar.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * TracksPanel info bar DOM. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | {namespace wtf.app.tracks.trackinfobar} 15 | 16 | 17 | /** 18 | * Root control UI. 19 | */ 20 | {template .control} 21 |
22 |
23 | 24 | 25 | 28 | 36 | 37 |
26 | 27 | 29 | 35 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | {/template} 48 | -------------------------------------------------------------------------------- /src/wtf/app/tracks/tracks.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @author benvanik@google.com (Ben Vanik) 10 | */ 11 | 12 | @import "wtf/app/tracks/trackinfobar.less"; 13 | @import "wtf/app/tracks/trackspanel.less"; 14 | -------------------------------------------------------------------------------- /src/wtf/app/tracks/trackspanel.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * TracksPanel CSS. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | /* TracksPanel root. */ 15 | .appUiTracksPanel { 16 | .canvasOuter { 17 | position: absolute; 18 | left: 0; 19 | right: 0; 20 | top: 0; 21 | bottom: 0; 22 | margin-right: 300px; 23 | border-right: 1px solid #ebebeb; 24 | overflow: hidden; 25 | } 26 | .tracksCanvas { 27 | cursor: crosshair; 28 | } 29 | 30 | .infoControl { 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/wtf/app/tracks/trackspanel.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * TracksPanel DOM. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | {namespace wtf.app.tracks.trackspanel} 15 | 16 | 17 | /** 18 | * Root control UI. 19 | */ 20 | {template .control} 21 |
22 |
23 |
24 | 25 | 26 |
27 |
28 | {/template} 29 | -------------------------------------------------------------------------------- /src/wtf/bootstrap/mocha.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview mocha node.js test library loader. 10 | * Loads the Closure Library, the deps file, and sets up the testing 11 | * environment. 12 | * 13 | * This file is designed to be run directly and is required before any test 14 | * code runs. It is hardcoded to pull in Closure library, the wtf deps, and 15 | * import the main namespaces. 16 | * 17 | * Note that at the time this file runs Closure has not yet been loaded. 18 | * goog.* is not available! 19 | * 20 | * @author benvanik@google.com (Ben Vanik) 21 | */ 22 | 23 | 24 | (function(global) { 25 | // Load Chai, the assertion library. 26 | global['chai'] = require('chai'); 27 | 28 | // Load Closure Library and the wtf deps file. 29 | require('./node').importClosureLibrary([ 30 | 'wtf_js-deps.js' 31 | ]); 32 | 33 | goog.require('wtf.testing.mocha'); 34 | })(global); 35 | -------------------------------------------------------------------------------- /src/wtf/data/eventclass.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Event class enumeration. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.data.EventClass'); 15 | 16 | 17 | /** 18 | * Event class. 19 | * Each event in the stream is typed. Events may have additional flags that 20 | * describe their behavior. 21 | * @enum {number} 22 | */ 23 | wtf.data.EventClass = { 24 | /** 25 | * Event indicating a single instance of something. 26 | */ 27 | INSTANCE: 0, 28 | 29 | /** 30 | * Event marks scope entrace. 31 | * This allows for specialized events to indicate both the occurance of 32 | * an event and enter a scope cleanly. 33 | */ 34 | SCOPE: 1 35 | }; 36 | 37 | 38 | goog.exportSymbol( 39 | 'wtf.data.EventClass', 40 | wtf.data.EventClass); 41 | goog.exportProperty( 42 | wtf.data.EventClass, 'INSTANCE', 43 | wtf.data.EventClass.INSTANCE); 44 | goog.exportProperty( 45 | wtf.data.EventClass, 'SCOPE', 46 | wtf.data.EventClass.SCOPE); 47 | -------------------------------------------------------------------------------- /src/wtf/data/zonetype.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Zone type enumeration. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.data.ZoneType'); 15 | 16 | 17 | /** 18 | * Default zone types. 19 | * Any string value is valid, however these are standard ones. 20 | * @enum {string} 21 | */ 22 | wtf.data.ZoneType = { 23 | /** 24 | * Primary script context. 25 | * Usually just user JavaScript scopes. This is the default scope created for 26 | * all traces. 27 | */ 28 | SCRIPT: 'script', 29 | 30 | /** 31 | * Native script context. 32 | * Native runtime scopes, such as the C++ calls above the JavaScript. 33 | */ 34 | NATIVE_SCRIPT: 'native_script', 35 | 36 | /** 37 | * Native GPU thread context. 38 | * This is not the GPU itself but instead the thread calling GPU driver 39 | * methods. 40 | */ 41 | NATIVE_GPU: 'native_gpu', 42 | 43 | /** 44 | * Native browser context. 45 | * This is the browser thread that usually routes input events and other 46 | * global operations. 47 | */ 48 | NATIVE_BROWSER: 'native_browser' 49 | }; 50 | 51 | 52 | goog.exportSymbol( 53 | 'wtf.data.ZoneType', 54 | wtf.data.ZoneType); 55 | goog.exportProperty( 56 | wtf.data.ZoneType, 'SCRIPT', 57 | wtf.data.ZoneType.SCRIPT); 58 | goog.exportProperty( 59 | wtf.data.ZoneType, 'NATIVE_SCRIPT', 60 | wtf.data.ZoneType.NATIVE_SCRIPT); 61 | goog.exportProperty( 62 | wtf.data.ZoneType, 'NATIVE_GPU', 63 | wtf.data.ZoneType.NATIVE_GPU); 64 | goog.exportProperty( 65 | wtf.data.ZoneType, 'NATIVE_BROWSER', 66 | wtf.data.ZoneType.NATIVE_BROWSER); 67 | -------------------------------------------------------------------------------- /src/wtf/db/node.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Database Node.js entry point. 10 | * Exports some utility functions for node applications. 11 | * 12 | * @author benvanik@google.com (Ben Vanik) 13 | */ 14 | 15 | goog.provide('wtf.db.node'); 16 | 17 | /** @suppress {extraRequire} */ 18 | goog.require('goog.debug.ErrorHandler'); 19 | /** @suppress {extraRequire} */ 20 | goog.require('goog.events.EventHandler'); 21 | /** @suppress {extraRequire} */ 22 | goog.require('goog.events.EventTarget'); 23 | /** @suppress {extraRequire} */ 24 | goog.require('wtf.pal'); 25 | 26 | 27 | /** 28 | * Placeholder function. 29 | */ 30 | wtf.db.node = function() { 31 | }; 32 | -------------------------------------------------------------------------------- /src/wtf/doc/profile.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Settings profile. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.doc.Profile'); 15 | 16 | goog.require('wtf.doc.ProfileScope'); 17 | goog.require('wtf.events.EventEmitter'); 18 | goog.require('wtf.events.SimpleEventfulMap'); 19 | 20 | 21 | 22 | /** 23 | * Settings profile. 24 | * @param {string} name Profile name. 25 | * @constructor 26 | * @extends {wtf.events.EventEmitter} 27 | */ 28 | wtf.doc.Profile = function(name) { 29 | goog.base(this); 30 | 31 | /** 32 | * Profile name. 33 | * @type {string} 34 | * @private 35 | */ 36 | this.name_ = name; 37 | 38 | /** 39 | * Profile scopes. 40 | * @type {!wtf.events.EventfulMap} 41 | * @private 42 | */ 43 | this.scopes_ = new wtf.events.SimpleEventfulMap(); 44 | this.registerDisposable(this.scopes_); 45 | }; 46 | goog.inherits(wtf.doc.Profile, wtf.events.EventEmitter); 47 | 48 | 49 | /** 50 | * Gets the profile name. 51 | * @return {string} Profile name. 52 | */ 53 | wtf.doc.Profile.prototype.getName = function() { 54 | return this.name_; 55 | }; 56 | 57 | 58 | /** 59 | * Gets the profile scope with the given name, creating it if needed. 60 | * @param {string} name Profile scope name. 61 | * @return {!wtf.doc.ProfileScope} The requested profile scope. 62 | */ 63 | wtf.doc.Profile.prototype.getScope = function(name) { 64 | var value = this.scopes_.get(name); 65 | if (!value) { 66 | value = new wtf.doc.ProfileScope(name); 67 | this.scopes_.set(name, value); 68 | } 69 | return /** @type {!wtf.doc.ProfileScope} */ (value); 70 | }; 71 | -------------------------------------------------------------------------------- /src/wtf/events/eventtype.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Common event types. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.events.EventType'); 15 | 16 | goog.require('goog.events'); 17 | 18 | 19 | /** 20 | * Event type names. 21 | * @enum {string} 22 | */ 23 | wtf.events.EventType = { 24 | INVALIDATED: goog.events.getUniqueId('invalidated') 25 | }; 26 | -------------------------------------------------------------------------------- /src/wtf/hud/exports.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview HUD API exports. 10 | * Exports the HUD to external code. 11 | * 12 | * @author benvanik@google.com (Ben Vanik) 13 | */ 14 | 15 | goog.provide('wtf.hud.exports'); 16 | 17 | goog.require('wtf.hud'); 18 | 19 | 20 | /** 21 | * @define {boolean} Whether to enable exporting of the wtf.hud 22 | * types and namespace. 23 | * 24 | * This should only be enabled in builds of the standalone library. If you're 25 | * including this code with it enabled in Closurized javascript then you'll 26 | * prevent renaming. 27 | */ 28 | wtf.hud.exports.ENABLE_EXPORTS = false; 29 | 30 | 31 | if (wtf.hud.exports.ENABLE_EXPORTS) { 32 | // wtf.hud controls 33 | goog.exportSymbol( 34 | 'wtf.hud.prepare', 35 | wtf.hud.prepare); 36 | goog.exportSymbol( 37 | 'wtf.hud.show', 38 | wtf.hud.show); 39 | goog.exportSymbol( 40 | 'wtf.hud.hide', 41 | wtf.hud.hide); 42 | goog.exportSymbol( 43 | 'wtf.hud.advance', 44 | wtf.hud.advance); 45 | goog.exportSymbol( 46 | 'wtf.hud.addButton', 47 | wtf.hud.addButton); 48 | goog.exportSymbol( 49 | 'wtf.hud.sendSnapshotToWindow', 50 | wtf.hud.sendSnapshotToWindow); 51 | } 52 | -------------------------------------------------------------------------------- /src/wtf/hud/hud.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Main HUD LESS file. 10 | * This is the root file built into the CSS used by the HUD. 11 | * 12 | * @author benvanik@google.com (Ben Vanik) 13 | */ 14 | 15 | 16 | // This prevents the reset from taking over the entire page. 17 | .wtfReset { 18 | // TODO(benvanik): figure out a way to get the reset on the page. 19 | @import "wtf/ui/styles/reset.less"; 20 | 21 | @import "wtf/ui/ui.less"; 22 | @import "wtf/hud/overlay.less"; 23 | @import "wtf/hud/livegraph.less"; 24 | } 25 | -------------------------------------------------------------------------------- /src/wtf/hud/livegraph.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @author benvanik@google.com (Ben Vanik) 10 | */ 11 | -------------------------------------------------------------------------------- /src/wtf/hud/overlay.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * HUD overlay DOM. 10 | * Note: all CSS names are exported publicly to enable theming and prevent 11 | * on-page conflicts. 12 | * 13 | * @author benvanik@google.com (Ben Vanik) 14 | */ 15 | 16 | {namespace wtf.hud.overlay} 17 | 18 | 19 | /** 20 | * Root control UI. 21 | */ 22 | {template .control} 23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | {/template} 31 | -------------------------------------------------------------------------------- /src/wtf/io/eventtype.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview IO event types. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.io.EventType'); 15 | 16 | goog.require('goog.events'); 17 | 18 | 19 | /** 20 | * Event type names. 21 | * @enum {string} 22 | */ 23 | wtf.io.EventType = { 24 | READ: goog.events.getUniqueId('read') 25 | }; 26 | -------------------------------------------------------------------------------- /src/wtf/io/transports/nullwritetransport.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview No-op transport types. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.io.transports.NullWriteTransport'); 15 | 16 | goog.require('wtf.io.WriteTransport'); 17 | 18 | 19 | 20 | /** 21 | * Write-only no-op transport base type. 22 | * @constructor 23 | * @extends {wtf.io.WriteTransport} 24 | */ 25 | wtf.io.transports.NullWriteTransport = function() { 26 | goog.base(this); 27 | }; 28 | goog.inherits(wtf.io.transports.NullWriteTransport, wtf.io.WriteTransport); 29 | 30 | 31 | /** 32 | * @override 33 | */ 34 | wtf.io.transports.NullWriteTransport.prototype.write = function(data) { 35 | // No-op. 36 | }; 37 | 38 | 39 | /** 40 | * @override 41 | */ 42 | wtf.io.transports.NullWriteTransport.prototype.flush = function() { 43 | // No-op. 44 | }; 45 | -------------------------------------------------------------------------------- /src/wtf/io/writetransport.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Transport abstract base types. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.io.WriteTransport'); 15 | 16 | goog.require('wtf.events.EventEmitter'); 17 | 18 | 19 | 20 | /** 21 | * Write-only transport base type. 22 | * A transport is the lowest-level primitive for IO. It provides a normalized 23 | * reading/writing API for a resource such as a URL endpoint or file. 24 | * 25 | * @constructor 26 | * @extends {wtf.events.EventEmitter} 27 | */ 28 | wtf.io.WriteTransport = function() { 29 | goog.base(this); 30 | 31 | /** 32 | * Whether the transport was created by the library and should be disposed 33 | * when done with. 34 | * @type {boolean} 35 | */ 36 | this.needsLibraryDispose = false; 37 | }; 38 | goog.inherits(wtf.io.WriteTransport, wtf.events.EventEmitter); 39 | 40 | 41 | /** 42 | * @override 43 | */ 44 | wtf.io.WriteTransport.prototype.disposeInternal = function() { 45 | goog.base(this, 'disposeInternal'); 46 | }; 47 | 48 | 49 | /** 50 | * Writes data to the transport. 51 | * @param {!wtf.io.BlobData} data Data to write. 52 | */ 53 | wtf.io.WriteTransport.prototype.write = goog.abstractMethod; 54 | 55 | 56 | /** 57 | * Flushes any pending buffers to the target. 58 | */ 59 | wtf.io.WriteTransport.prototype.flush = goog.abstractMethod; 60 | -------------------------------------------------------------------------------- /src/wtf/ipc/channel.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Abstract IPC channel. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.ipc.Channel'); 15 | 16 | goog.require('goog.events'); 17 | goog.require('wtf.events.EventEmitter'); 18 | 19 | 20 | 21 | /** 22 | * Abstract IPC channel. 23 | * 24 | * @constructor 25 | * @extends {wtf.events.EventEmitter} 26 | */ 27 | wtf.ipc.Channel = function() { 28 | goog.base(this); 29 | }; 30 | goog.inherits(wtf.ipc.Channel, wtf.events.EventEmitter); 31 | 32 | 33 | /** 34 | * Event types for channels. 35 | * @enum {string} 36 | */ 37 | wtf.ipc.Channel.EventType = { 38 | /** 39 | * Incoming message. Handlers receive the data as their only argument. 40 | */ 41 | MESSAGE: goog.events.getUniqueId('message') 42 | }; 43 | 44 | 45 | /** 46 | * Gets a value indicating whether the channel is currently connected. 47 | * @return {boolean} True if the channel is connected. 48 | */ 49 | wtf.ipc.Channel.prototype.isConnected = goog.abstractMethod; 50 | 51 | 52 | /** 53 | * Sends a message. 54 | * @param {!Object} data Message to send. 55 | * @param {Array.=} opt_transferrables Transferrable objects contained 56 | * within {@code data}. 57 | */ 58 | wtf.ipc.Channel.prototype.postMessage = goog.abstractMethod; 59 | -------------------------------------------------------------------------------- /src/wtf/math/math.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Math utilities. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.math'); 15 | 16 | 17 | /** 18 | * Remaps a value from one range to another. 19 | * @param {number} value Value in range 1. 20 | * @param {number} min1 Minimum value in range 1. 21 | * @param {number} max1 Maximum value in range 1. 22 | * @param {number} min2 Minimum value in range 2. 23 | * @param {number} max2 Maximum value in range 2. 24 | * @return {number} Remapped value in range 2. 25 | */ 26 | wtf.math.remap = function(value, min1, max1, min2, max2) { 27 | return min2 + (value - min1) * (max2 - min2) / (max1 - min1); 28 | }; 29 | 30 | 31 | /** 32 | * Remaps a value from one range to another using an easing function. 33 | * @param {number} value Value in range 1. 34 | * @param {number} min1 Minimum value in range 1. 35 | * @param {number} max1 Maximum value in range 1. 36 | * @param {number} min2 Minimum value in range 2. 37 | * @param {number} max2 Maximum value in range 2. 38 | * @return {number} Remapped value in range 2. 39 | */ 40 | wtf.math.smoothRemap = function(value, min1, max1, min2, max2) { 41 | if (value < min1) { 42 | return min2; 43 | } else if (value > max1) { 44 | return max2; 45 | } 46 | var v = (value - min1) / (max1 - min1); 47 | v = 3 * v * v - 2 * v * v * v; 48 | return min2 + v * (max2 - min2); 49 | }; 50 | -------------------------------------------------------------------------------- /src/wtf/pal/chromeplatform.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Chrome extension platform abstraction layer. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.pal.ChromePlatform'); 15 | 16 | goog.require('wtf.pal.BrowserPlatform'); 17 | 18 | 19 | 20 | /** 21 | * Chrome extension platform abstraction layer implementation. 22 | * @constructor 23 | * @extends {wtf.pal.BrowserPlatform} 24 | */ 25 | wtf.pal.ChromePlatform = function() { 26 | goog.base(this); 27 | }; 28 | goog.inherits(wtf.pal.ChromePlatform, wtf.pal.BrowserPlatform); 29 | -------------------------------------------------------------------------------- /src/wtf/pal/iplatform.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Platform abstraction layer. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.pal.IPlatform'); 15 | 16 | 17 | 18 | /** 19 | * Platform abstraction interface. 20 | * 21 | * @interface 22 | */ 23 | wtf.pal.IPlatform = function() {}; 24 | 25 | 26 | /** 27 | * Gets the directory the tool was launched from. 28 | * @return {string} Working directory. 29 | */ 30 | wtf.pal.IPlatform.prototype.getWorkingDirectory = goog.nullFunction; 31 | 32 | 33 | /** 34 | * Reads a file from the given path as a utf8 string. 35 | * @param {string} path File path. 36 | * @return {string?} File contents. 37 | */ 38 | wtf.pal.IPlatform.prototype.readTextFile = goog.nullFunction; 39 | 40 | 41 | /** 42 | * Reads a file from the given path as a binary blob. 43 | * @param {string} path File path. 44 | * @return {wtf.io.ByteArray?} File contents. 45 | */ 46 | wtf.pal.IPlatform.prototype.readBinaryFile = goog.nullFunction; 47 | 48 | 49 | /** 50 | * Writes a file to the given path as a utf8 string. 51 | * @param {string} path File path. 52 | * @param {string} contents File contents. 53 | * @param {string=} opt_mimeType File mime type. 54 | */ 55 | wtf.pal.IPlatform.prototype.writeTextFile = goog.nullFunction; 56 | 57 | 58 | /** 59 | * Writes a file to the given path as a binary blob. 60 | * @param {string} path File path. 61 | * @param {!(wtf.io.ByteArray|Blob)} contents File contents. 62 | * @param {string=} opt_mimeType File mime type. 63 | */ 64 | wtf.pal.IPlatform.prototype.writeBinaryFile = goog.nullFunction; 65 | -------------------------------------------------------------------------------- /src/wtf/pal/pal.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Platform abstraction layer namespace. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.pal'); 15 | 16 | goog.require('wtf'); 17 | goog.require('wtf.pal.BrowserPlatform'); 18 | goog.require('wtf.pal.ChromePlatform'); 19 | goog.require('wtf.pal.NodePlatform'); 20 | 21 | 22 | /** 23 | * Shared PAL singleton. 24 | * Initialized by {@see wtf.pal#getPlatform} on first request. 25 | * @type {wtf.pal.IPlatform} 26 | * @private 27 | */ 28 | wtf.pal.sharedPlatform_ = null; 29 | 30 | 31 | /** 32 | * Gets the shared platform instance. 33 | * @return {!wtf.pal.IPlatform} Shared platform. 34 | */ 35 | wtf.pal.getPlatform = function() { 36 | if (!wtf.pal.sharedPlatform_) { 37 | if (wtf.NODE) { 38 | wtf.pal.sharedPlatform_ = new wtf.pal.NodePlatform(); 39 | } else { 40 | if (goog.global['chrome'] && 41 | goog.global['chrome']['runtime']) { 42 | wtf.pal.sharedPlatform_ = new wtf.pal.ChromePlatform(); 43 | } else { 44 | wtf.pal.sharedPlatform_ = new wtf.pal.BrowserPlatform(); 45 | } 46 | } 47 | } 48 | return wtf.pal.sharedPlatform_; 49 | }; 50 | 51 | 52 | goog.exportSymbol( 53 | 'wtf.pal.getPlatform', 54 | wtf.pal.getPlatform); 55 | -------------------------------------------------------------------------------- /src/wtf/remote/exports.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Remote API exports. 10 | * Exports the remote control utilities to external code. 11 | * 12 | * @author benvanik@google.com (Ben Vanik) 13 | */ 14 | 15 | goog.provide('wtf.remote.exports'); 16 | 17 | goog.require('wtf.remote'); 18 | 19 | 20 | /** 21 | * @define {boolean} Whether to enable exporting of the wtf.remote 22 | * types and namespace. 23 | * 24 | * This should only be enabled in builds of the standalone library. If you're 25 | * including this code with it enabled in Closurized javascript then you'll 26 | * prevent renaming. 27 | */ 28 | wtf.remote.exports.ENABLE_EXPORTS = false; 29 | 30 | 31 | if (wtf.remote.exports.ENABLE_EXPORTS) { 32 | // wtf.remote controls 33 | goog.exportSymbol( 34 | 'wtf.remote.connect', 35 | wtf.remote.connect); 36 | goog.exportSymbol( 37 | 'wtf.remote.disconnect', 38 | wtf.remote.disconnect); 39 | goog.exportSymbol( 40 | 'wtf.remote.isConnected', 41 | wtf.remote.isConnected); 42 | } 43 | -------------------------------------------------------------------------------- /src/wtf/replay/graphics/exports.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Graphics Replay API exports. 10 | * This file will export a bunch of public symbols allowing for use of the 11 | * tracing library from non-Closure code. The master enable define must be set 12 | * to true to enable this so that the exports are not performed when in 13 | * Closurized code. 14 | * 15 | * @author chizeng@google.com (Chi Zeng) 16 | */ 17 | 18 | goog.provide('wtf.replay.graphics.exports'); 19 | 20 | /** @suppress {extraRequire} */ 21 | goog.require('wtf.replay.graphics'); 22 | /** @suppress {extraRequire} */ 23 | goog.require('wtf.util'); 24 | 25 | 26 | /** 27 | * @define {boolean} Whether to enable exporting of the wtf.replay.graphics 28 | * types and namespace. 29 | * 30 | * This should only be enabled in builds of the standalone library. If you're 31 | * including this code with it enabled in Closurized javascript then you'll 32 | * prevent renaming. 33 | */ 34 | wtf.replay.graphics.exports.ENABLE_EXPORTS = false; 35 | -------------------------------------------------------------------------------- /src/wtf/replay/graphics/session_test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | goog.provide('wtf.replay.graphics.Session_test'); 9 | 10 | goog.require('goog.dom.DomHelper'); 11 | goog.require('wtf.db.Database'); 12 | goog.require('wtf.replay.graphics.Session'); 13 | 14 | 15 | /** 16 | * wtf.replay.graphics.Session testing. 17 | */ 18 | wtf.replay.graphics.Session_test = suite( 19 | 'wtf.replay.graphics.Session', function() { 20 | test('#ctor', function() { 21 | // Only run this test if the DOM exists. 22 | if (!window || !window.document) { 23 | return; 24 | } 25 | 26 | var db = new wtf.db.Database(); 27 | var domHelper = new goog.dom.DomHelper(); 28 | var parentElement = domHelper.createElement('div'); 29 | domHelper.appendChild(domHelper.getDocument().body, parentElement); 30 | var session = new wtf.replay.graphics.Session( 31 | db, parentElement, domHelper); 32 | assert.isNotNull(session); 33 | assert.isTrue(domHelper.getChildren(parentElement).length > 0); 34 | 35 | goog.dispose(db); 36 | goog.dispose(session); 37 | 38 | // The parent element should have no children now. 39 | assert.equal(domHelper.getChildren(parentElement).length, 0); 40 | }); 41 | }); 42 | -------------------------------------------------------------------------------- /src/wtf/replay/graphics/ui/argumentsdialog.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Graphics replay argument-editing dialog LESS file. 10 | * 11 | * @author chizeng@google.com (Chi Zeng) 12 | */ 13 | 14 | .graphicsReplayArgumentsDialog { 15 | height: auto; 16 | 17 | & .form { 18 | & .header { 19 | & .buttons { 20 | & .kButton { 21 | margin: 0 0 0 16px; 22 | } 23 | 24 | & .saveArgumentsButton {} 25 | 26 | & .resetArgumentsButton {} 27 | 28 | & .cancelButton {} 29 | } 30 | } 31 | 32 | & .contents { 33 | margin: 0 0 0 40px; 34 | position: static; 35 | } 36 | 37 | .dialogFields { 38 | margin: 10px 0 0 0; 39 | 40 | & .graphicsReplayArgumentsDialogArgKeyPair { 41 | margin: 15px 0 0 0; 42 | 43 | & .graphicsReplayArgumentsDialogInputContainer { 44 | 45 | & .dataDumpText { 46 | width: 100%; 47 | } 48 | } 49 | } 50 | } 51 | 52 | /* Forms need a submit input element for Enter to work. */ 53 | & .hiddenSubmit { 54 | visibility: hidden; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/wtf/replay/graphics/ui/argumentsdialog.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Arguments dialog (the dialog that lets users alter arguments of events) DOM 10 | * for graphics replay. 11 | * 12 | * @author chizeng@google.com (Chi Zeng) 13 | */ 14 | 15 | {namespace wtf.replay.graphics.ui.argumentsdialog} 16 | 17 | 18 | /** 19 | * Root control UI of the arguments dialog. 20 | */ 21 | {template .control} 22 |
23 |
24 |
25 |
26 | Update 27 | Reset 28 | Cancel 29 |
30 |

31 |
32 |
33 |
34 |
35 |
36 |
37 | 38 | 39 |
40 |
41 | {/template} 42 | 43 | 44 | /** 45 | * A field / input pair for the form on the arguments dialog. 46 | * @param argumentKey The key of the argument. 47 | */ 48 | {template .argumentkeyvaluepair} 49 |
50 | 51 |
52 |
53 | {/template} 54 | -------------------------------------------------------------------------------- /src/wtf/replay/graphics/ui/canvasarea.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Canvas area controller LESS file. 10 | * 11 | * @author chizeng@google.com (Chi Zeng) 12 | */ 13 | 14 | .replayGraphicsCanvasArea {} 15 | -------------------------------------------------------------------------------- /src/wtf/replay/graphics/ui/canvasarea.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * A container for canvases for graphics replay. 10 | * 11 | * @author chizeng@google.com (Chi Zeng) 12 | */ 13 | 14 | {namespace wtf.replay.graphics.ui.canvasArea} 15 | 16 | /** 17 | * Area for canvases. 18 | */ 19 | {template .controller} 20 |
21 |
22 | {/template} 23 | -------------------------------------------------------------------------------- /src/wtf/replay/graphics/ui/contextbox.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Graphics context box controller LESS file. 10 | * 11 | * @author chizeng@google.com (Chi Zeng) 12 | */ 13 | 14 | .replayGraphicsContextBox { 15 | border: 1px solid #bbbbbb; 16 | margin: 5px; 17 | float: left; 18 | 19 | .replayGraphicsContextBoxHandleLabel { 20 | padding: 5px; 21 | 22 | border-bottom: 1px solid #bbbbbb; 23 | background-color: #ebebeb; 24 | font-family: monospace; 25 | } 26 | 27 | .replayGraphicsContextBoxCanvasContainer { 28 | line-height: 0; 29 | 30 | background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAJUlEQVQYV2N8/fr1fwY0ICoqyoguxjgUFKI7GsTH5m4M3w1ChQC9EybLRzKdKQAAAABJRU5ErkJggg==) repeat; 31 | } 32 | 33 | .replayGraphicsContextBoxMessage { 34 | padding: 3px; 35 | white-space: pre; 36 | 37 | border-top: 1px solid #bbbbbb; 38 | background-color: #ebebeb; 39 | font-family: monospace; 40 | text-align: right; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/wtf/replay/graphics/ui/contextbox.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * A container for a single canvas. 10 | * 11 | * @author chizeng@google.com (Chi Zeng) 12 | */ 13 | 14 | {namespace wtf.replay.graphics.ui.contextBox} 15 | 16 | /** 17 | * A box for a canvas. 18 | */ 19 | {template .controller} 20 |
21 |
22 |
23 |
24 |
25 | {/template} 26 | -------------------------------------------------------------------------------- /src/wtf/replay/graphics/ui/eventnavigator.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Event navigator controller LESS file. 10 | * 11 | * @author chizeng@google.com (Chi Zeng) 12 | */ 13 | 14 | .replayGraphicsEventNavigator { 15 | @toolbarHeight: 40px; 16 | 17 | .fitParent(); 18 | 19 | & .toolbarContainer { 20 | .fitParent(); 21 | } 22 | 23 | & .tableOuter { 24 | .fitParent(); 25 | 26 | top: @toolbarHeight; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/wtf/replay/graphics/ui/eventnavigator.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * A container for a navigator of events for graphics replay. 10 | * 11 | * @author chizeng@google.com (Chi Zeng) 12 | */ 13 | 14 | {namespace wtf.replay.graphics.ui.eventNavigator} 15 | 16 | 17 | /** 18 | * A navigator of events. 19 | */ 20 | {template .controller} 21 |
22 |
23 |
24 |
25 | {/template} 26 | -------------------------------------------------------------------------------- /src/wtf/replay/graphics/ui/eventnavigatortoolbar.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Graphics replay event navigator (for within a step) toolbar LESS file. 10 | * 11 | * @author chizeng@google.com (Chi Zeng) 12 | */ 13 | 14 | .graphicsReplayEventNavigatorToolbar { 15 | padding: 5px; 16 | border-bottom: 1px solid #ebebeb; 17 | 18 | td { 19 | vertical-align: top; 20 | } 21 | 22 | .leftButtons { 23 | min-width: 282px; 24 | } 25 | .center { 26 | width: 100%; 27 | padding-right: 5px; 28 | 29 | & .kSearchField { 30 | width: 100%; 31 | font-family: monospace; 32 | font-size: 11px; 33 | } 34 | } 35 | .rightButtons { 36 | width: 1%; 37 | padding-left: 5px; 38 | } 39 | 40 | .searchBox {} 41 | 42 | .firstCallButton {} 43 | .previousDrawCallButton {} 44 | .nextDrawCallButton {} 45 | .lastCallButton {} 46 | .toggleOverdrawButton {} 47 | 48 | .optionsButton { 49 | z-index: 0 !important; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/wtf/replay/graphics/ui/graphics.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Main graphics replay LESS file. 10 | * This is the root file built into the CSS used by the graphics replay UI. 11 | * 12 | * @author chizeng@google.com (Chi Zeng) 13 | */ 14 | 15 | @import "wtf/replay/graphics/ui/argumentsdialog.less"; 16 | @import "wtf/replay/graphics/ui/canvasarea.less"; 17 | @import "wtf/replay/graphics/ui/contextbox.less"; 18 | @import "wtf/replay/graphics/ui/eventnavigator.less"; 19 | @import "wtf/replay/graphics/ui/eventnavigatortoolbar.less"; 20 | @import "wtf/replay/graphics/ui/graphicspanel.less"; 21 | @import "wtf/replay/graphics/ui/graphicstoolbar.less"; 22 | @import "wtf/replay/graphics/ui/rangeseeker.less"; 23 | -------------------------------------------------------------------------------- /src/wtf/replay/graphics/ui/graphicspanel.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Graphics replay controller LESS file. 10 | * 11 | * @author chizeng@google.com (Chi Zeng) 12 | */ 13 | 14 | 15 | .graphicsReplayPanel { 16 | @topRowHeight: 40px; 17 | @eventNavigationWidth: 525px; 18 | 19 | .topRow { 20 | width: 100%; 21 | margin: 5px; 22 | 23 | .toolbar { 24 | vertical-align: top; 25 | min-width: 311px; 26 | } 27 | .rangeSeeker { 28 | vertical-align: top; 29 | width: 100%; 30 | } 31 | .resizeCanvasesToFitButton { 32 | margin: 0 20px 0 0; 33 | width: 100px; 34 | } 35 | } 36 | 37 | .graphicsReplayMainContent { 38 | position: absolute; 39 | left: 0; 40 | top: @topRowHeight; 41 | right: 0; 42 | bottom: 0; 43 | 44 | border-top: 1px solid #ebebeb; 45 | } 46 | 47 | .graphicsReplayStepEventNavigation { 48 | position: absolute; 49 | left: 0; 50 | top: 0; 51 | bottom: 0; 52 | width: @eventNavigationWidth; 53 | overflow: hidden; 54 | 55 | border-right: 1px solid #ebebeb; 56 | 57 | .graphicsReplayEventNavigatorContainer { 58 | .fitParent(); 59 | 60 | margin-right: 8px; 61 | } 62 | 63 | .graphicsReplayMainSplitter {} 64 | } 65 | 66 | .graphicsReplayMainDisplay { 67 | position: absolute; 68 | left: @eventNavigationWidth; 69 | right: 0; 70 | top: 0; 71 | bottom: 0; 72 | overflow-x: auto; 73 | overflow-y: auto; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/wtf/replay/graphics/ui/graphicspanel.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Graphics panel DOM. 10 | * 11 | * @author chizeng@google.com (Chi Zeng) 12 | */ 13 | 14 | {namespace wtf.replay.graphics.ui.graphicsPanel} 15 | 16 | 17 | /** 18 | * Graphics panel control UI. 19 | */ 20 | {template .controller} 21 |
22 | 23 | 24 | 25 | 26 | 31 | 32 |
27 | 28 | Resize to Fit 29 | 30 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | {/template} 43 | -------------------------------------------------------------------------------- /src/wtf/replay/graphics/ui/graphicstoolbar.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Graphics replay toolbar LESS file. 10 | * 11 | * @author chizeng@google.com (Chi Zeng) 12 | */ 13 | 14 | .graphicsReplayToolbar { 15 | .resetButton {} 16 | .backButton {} 17 | .playButton {} 18 | .forwardButton {} 19 | .resetVisualizersButton {} 20 | 21 | .playing {} 22 | .playButtonIcon {} 23 | .playButton > .pauseButtonIcon { 24 | display: none; 25 | } 26 | .playing > .playButtonIcon { 27 | display: none; 28 | } 29 | .playing > .pauseButtonIcon { 30 | display: inline; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/wtf/replay/graphics/ui/graphicstoolbar.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * A container for toolbars for graphics replay. 10 | * 11 | * @author chizeng@google.com (Chi Zeng) 12 | */ 13 | 14 | {namespace wtf.replay.graphics.ui.graphicsToolbar} 15 | 16 | /** 17 | * Container of control buttons (play, forward, backward, etc). 18 | */ 19 | {template .controller} 20 | 40 | {/template} 41 | -------------------------------------------------------------------------------- /src/wtf/replay/graphics/ui/rangeseeker.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Graphics replay range controller LESS file. 10 | * 11 | * @author chizeng@google.com (Chi Zeng) 12 | */ 13 | 14 | .graphicsReplayRangeSeeker { 15 | margin-right: 10px; 16 | 17 | & .canvas { 18 | cursor: crosshair; 19 | margin-top: -4px; 20 | } 21 | 22 | & .canvasPointer { 23 | cursor: pointer; 24 | } 25 | 26 | & .canvasOuter { 27 | display: inline-block; 28 | position: relative; 29 | width: 90%; 30 | height: 32px; 31 | overflow: hidden; 32 | margin: -2px 1px 1px 1px; 33 | padding: 1px; 34 | border: 1px solid #ebebeb; 35 | } 36 | 37 | & .graphicsReplayRangeSeekerDisplayer { 38 | display: inline-block; 39 | margin: -14px 0 0 10px; 40 | width: 5%; 41 | vertical-align: middle; 42 | 43 | & .kTextField { 44 | margin: -13px 0 0 0; 45 | width: 80%; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/wtf/replay/graphics/ui/rangeseeker.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * A tool for seeking range. 10 | * 11 | * @author chizeng@google.com (Chi Zeng) 12 | */ 13 | 14 | {namespace wtf.replay.graphics.ui.graphicsRangeSeeker} 15 | 16 | /** 17 | * A controller for seeking within a range. 18 | */ 19 | {template .controller} 20 |
21 |
22 | 23 |
24 |
25 |
26 | {/template} 27 | -------------------------------------------------------------------------------- /src/wtf/replay/timetravel/controller.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Session controller popup window. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.replay.timeTravel.Controller'); 15 | 16 | goog.require('goog.soy'); 17 | goog.require('wtf.replay.timeTravel.controller'); 18 | goog.require('wtf.ui.Control'); 19 | 20 | 21 | 22 | /** 23 | * Popup replay controller dialog. 24 | * Manages the UI displayed to the user. 25 | * 26 | * @param {!Element} parentElement Element to display in. 27 | * @param {!goog.dom.DomHelper} dom DOM helper. 28 | * @constructor 29 | * @extends {wtf.ui.Control} 30 | */ 31 | wtf.replay.timeTravel.Controller = function(parentElement, dom) { 32 | goog.base(this, parentElement, dom); 33 | }; 34 | goog.inherits(wtf.replay.timeTravel.Controller, wtf.ui.Control); 35 | 36 | 37 | /** 38 | * @override 39 | */ 40 | wtf.replay.timeTravel.Controller.prototype.createDom = function(dom) { 41 | return /** @type {!Element} */ (goog.soy.renderAsFragment( 42 | wtf.replay.timeTravel.controller.control, undefined, undefined, dom)); 43 | }; 44 | 45 | 46 | /** 47 | * @override 48 | */ 49 | wtf.replay.timeTravel.Controller.prototype.layoutInternal = function() { 50 | }; 51 | -------------------------------------------------------------------------------- /src/wtf/replay/timetravel/controller.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Time travel controller LESS file. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | .replayTimeTravelController { 15 | .fitParent(); 16 | } 17 | -------------------------------------------------------------------------------- /src/wtf/replay/timetravel/controller.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Popup controller DOM. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | {namespace wtf.replay.timeTravel.controller} 15 | 16 | 17 | /** 18 | * Root control UI. 19 | */ 20 | {template .control} 21 |
22 | Experimental! 23 |
24 | {/template} 25 | -------------------------------------------------------------------------------- /src/wtf/replay/timetravel/exports.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Time travel API exports. 10 | * This file will export a bunch of public symbols allowing for use of the 11 | * tracing library from non-Closure code. The master enable define must be set 12 | * to true to enable this so that the exports are not performed when in 13 | * Closurized code. 14 | * 15 | * @author benvanik@google.com (Ben Vanik) 16 | */ 17 | 18 | goog.provide('wtf.replay.timeTravel.exports'); 19 | 20 | /** @suppress {extraRequire} */ 21 | goog.require('wtf.replay.timeTravel'); 22 | /** @suppress {extraRequire} */ 23 | goog.require('wtf.util'); 24 | 25 | 26 | /** 27 | * @define {boolean} Whether to enable exporting of the wtf.replay.timeTravel 28 | * types and namespace. 29 | * 30 | * This should only be enabled in builds of the standalone library. If you're 31 | * including this code with it enabled in Closurized javascript then you'll 32 | * prevent renaming. 33 | */ 34 | wtf.replay.timeTravel.exports.ENABLE_EXPORTS = false; 35 | -------------------------------------------------------------------------------- /src/wtf/replay/timetravel/timetravel.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Main time travel LESS file. 10 | * This is the root file built into the CSS used by the time travel UI. 11 | * 12 | * @author benvanik@google.com (Ben Vanik) 13 | */ 14 | 15 | // TODO(benvanik): right now we are included by the app/app.less to simplify 16 | // the number of build targets. It'd be nice to split this out on its own. 17 | //@import "wtf/ui/styles/reset.less"; 18 | //@import "wtf/ui/ui.less"; 19 | 20 | @import "wtf/replay/timetravel/controller.less"; 21 | -------------------------------------------------------------------------------- /src/wtf/testing/mocha-run.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview mocha testing runner. 10 | * 11 | * This file is required at the very end of the testing process to kick off 12 | * mocha. 13 | * 14 | * @author benvanik@google.com (Ben Vanik) 15 | */ 16 | 17 | goog.provide('wtf.testing.mocha.run'); 18 | 19 | 20 | /** 21 | * Runs mocha with all tests currently loaded. 22 | */ 23 | wtf.testing.mocha.run = function() { 24 | var mocha = goog.global['mocha']; 25 | mocha['run'](function() { 26 | // Fired when tests have completed. 27 | wtf.testing.mocha.run.hasCompleted = true; 28 | var mochaCompletionWaiter = goog.global['mochaCompletionWaiter']; 29 | if (mochaCompletionWaiter) { 30 | mochaCompletionWaiter(); 31 | } 32 | }); 33 | }; 34 | 35 | 36 | /** 37 | * Set to true when the mocha run has completed. 38 | * @type {boolean} 39 | */ 40 | wtf.testing.mocha.run.hasCompleted = false; 41 | 42 | 43 | wtf.testing.mocha.run(); 44 | -------------------------------------------------------------------------------- /src/wtf/timing/browserinterval.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Browser setInterval-based timer handle. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.timing.BrowserInterval'); 15 | 16 | goog.require('wtf.timing.Handle'); 17 | 18 | 19 | 20 | /** 21 | * Browser interval handle/tracking object. 22 | * @param {function(number): void} func Pre-bound callback function. 23 | * @param {number} delay Number of milliseconds to wait between callbacks. 24 | * @constructor 25 | * @extends {wtf.timing.Handle} 26 | */ 27 | wtf.timing.BrowserInterval = function(func, delay) { 28 | goog.base(this, func); 29 | 30 | var setInterval = goog.global.setInterval['raw'] || goog.global.setInterval; 31 | var self = this; 32 | /** 33 | * @type {?number} 34 | * @private 35 | */ 36 | this.intervalId_ = setInterval.call(goog.global, function() { 37 | self.callback(); 38 | }, delay); 39 | }; 40 | goog.inherits(wtf.timing.BrowserInterval, wtf.timing.Handle); 41 | 42 | 43 | /** 44 | * @override 45 | */ 46 | wtf.timing.BrowserInterval.prototype.clear = function() { 47 | var clearInterval = goog.global.clearInterval['raw'] || 48 | goog.global.clearInterval; 49 | clearInterval.call(goog.global, this.intervalId_); 50 | this.intervalId_ = null; 51 | goog.base(this, 'clear'); 52 | }; 53 | -------------------------------------------------------------------------------- /src/wtf/timing/handle.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Base timer handle type. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | 15 | goog.provide('wtf.timing.Handle'); 16 | 17 | goog.require('goog.asserts'); 18 | 19 | 20 | 21 | /** 22 | * Base timing handle/tracking object. 23 | * @param {Function} func Callback function. 24 | * @constructor 25 | */ 26 | wtf.timing.Handle = function(func) { 27 | /** 28 | * @type {?Function} 29 | * @private 30 | */ 31 | this.func_ = func; 32 | }; 33 | 34 | 35 | /** 36 | * Issues the interval callback function. 37 | * @param {...*} var_args Arguments. 38 | */ 39 | wtf.timing.Handle.prototype.callback = function(var_args) { 40 | // Always check callback function - a previous callback this same tick could 41 | // have cleared this instance 42 | if (this.func_) { 43 | // Catch any exceptions so that other registered callbacks still run 44 | try { 45 | this.func_.apply(goog.global, arguments); 46 | } catch (e) { 47 | goog.asserts.fail('Unhandled exception in callback: ' + e); 48 | } 49 | } 50 | }; 51 | 52 | 53 | /** 54 | * Clears the interval so that it will no longer be called. 55 | */ 56 | wtf.timing.Handle.prototype.clear = function() { 57 | this.func_ = null; 58 | }; 59 | -------------------------------------------------------------------------------- /src/wtf/timing/renderinterval.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Render controller timer handle. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.timing.RenderInterval'); 15 | 16 | goog.require('wtf.timing.Handle'); 17 | 18 | 19 | 20 | /** 21 | * Rendering interval handle/tracking object. 22 | * @param {function(number): void} func Pre-bound callback function. 23 | * @constructor 24 | * @extends {wtf.timing.Handle} 25 | */ 26 | wtf.timing.RenderInterval = function(func) { 27 | goog.base(this, func); 28 | }; 29 | goog.inherits(wtf.timing.RenderInterval, wtf.timing.Handle); 30 | -------------------------------------------------------------------------------- /src/wtf/trace/eventsessioncontext.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Shared context referencing session state. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.trace.EventSessionContext'); 15 | goog.provide('wtf.trace.EventSessionContextType'); 16 | 17 | 18 | /** 19 | * Shared session context. 20 | * One of these is instantiated by the {@see wtf.trace.TraceManager} at startup 21 | * and bound to all generated event functions. That instance is kept the same 22 | * across all trace sessions that run, with only its contents changing. 23 | * 24 | * In order to make this easier to use from generated code it is just a simple 25 | * array with the elements inside of it. Use the static accessor methods to 26 | * manipulate it. 27 | */ 28 | wtf.trace.EventSessionContext = function() {}; 29 | 30 | 31 | /** 32 | * The event session context type. 33 | * @typedef {!Array} 34 | */ 35 | wtf.trace.EventSessionContextType; 36 | 37 | 38 | /** 39 | * Creates a new context. 40 | * @return {!wtf.trace.EventSessionContextType} New context. 41 | */ 42 | wtf.trace.EventSessionContext.create = function() { 43 | return new Array(2); 44 | }; 45 | 46 | 47 | /** 48 | * Initializes a context for the given session. 49 | * @param {!wtf.trace.EventSessionContextType} context Context. 50 | * @param {wtf.trace.Session} session Trace session, if any. 51 | */ 52 | wtf.trace.EventSessionContext.init = function(context, session) { 53 | context[0] = session; 54 | }; 55 | 56 | 57 | /** 58 | * Sets the buffer on the context. 59 | * @param {!wtf.trace.EventSessionContextType} context Context. 60 | * @param {!wtf.io.BufferView.Type} bufferView New buffer. 61 | */ 62 | wtf.trace.EventSessionContext.setBuffer = function(context, bufferView) { 63 | context[1] = bufferView; 64 | }; 65 | -------------------------------------------------------------------------------- /src/wtf/trace/node.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Tracing Node.js entry point. 10 | * Exports some utility functions for node applications. 11 | * 12 | * @author benvanik@google.com (Ben Vanik) 13 | */ 14 | 15 | goog.provide('wtf.trace.node'); 16 | 17 | goog.require('wtf'); 18 | goog.require('wtf.trace'); 19 | goog.require('wtf.trace.prepare'); 20 | 21 | 22 | if (wtf.NODE) { 23 | /** 24 | * Starts tracing and sets up a default save-on-exit handler. 25 | * @param {Object=} opt_options Options overrides. 26 | */ 27 | wtf.trace.node.start = function(opt_options) { 28 | // To make life easier we call prepare here. 29 | wtf.trace.prepare(opt_options); 30 | 31 | // Start tracing. 32 | wtf.trace.start(opt_options); 33 | 34 | // Setup process shutdown hook to snapshot/flush. 35 | process.on('exit', function() { 36 | // Snapshot and retrieve the resulting buffers. 37 | wtf.trace.snapshot('file://'); 38 | wtf.trace.stop(); 39 | }); 40 | 41 | // Handle ctrl-c. 42 | // NOTE: this may not work on Windows. 43 | process.on('SIGINT', function() { 44 | process.exit(); 45 | }); 46 | }; 47 | 48 | goog.exportSymbol( 49 | 'wtf.trace.node.start', 50 | wtf.trace.node.start); 51 | } 52 | -------------------------------------------------------------------------------- /src/wtf/trace/prepare.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Tracing preparation. 10 | * This file contains the prepare method used to initialize WTF tracing. 11 | * It's in its own file so that it can depend on files that many otherwise 12 | * create cycles if it was in wtf.trace. 13 | * 14 | * @author benvanik@google.com (Ben Vanik) 15 | */ 16 | 17 | goog.provide('wtf.trace.prepare'); 18 | 19 | goog.require('wtf.trace.TraceManager'); 20 | goog.require('wtf.trace.providers'); 21 | 22 | 23 | /** 24 | * Main entry point for the tracing API. 25 | * This must be called as soon as possible and preferably before any application 26 | * code is executed (or even included on the page). 27 | * 28 | * This method does not setup a tracing session, but prepares the environment 29 | * for one. It can be called many times but the options provided are not updated 30 | * once it's been called. 31 | * 32 | * @param {Object=} opt_options Options overrides. 33 | * @return {*} Ignored. 34 | */ 35 | wtf.trace.prepare = function(opt_options) { 36 | var existingInstance = wtf.trace.TraceManager.getSharedInstance(); 37 | if (existingInstance) { 38 | // TODO(benvanik): make sure options haven't changed? 39 | return existingInstance; 40 | } 41 | 42 | // Setup. 43 | var traceManager = new wtf.trace.TraceManager(opt_options); 44 | var options = traceManager.getOptions(); 45 | 46 | // Add providers. 47 | if (!options.getBoolean('wtf.trace.disableProviders', false)) { 48 | wtf.trace.providers.setup(traceManager); 49 | } 50 | 51 | // Stash the global object. 52 | wtf.trace.TraceManager.setSharedInstance(traceManager); 53 | 54 | return traceManager; 55 | }; 56 | -------------------------------------------------------------------------------- /src/wtf/trace/sessions/nullsession.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Null recording session instance. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.trace.sessions.NullSession'); 15 | 16 | goog.require('wtf.trace.Session'); 17 | 18 | 19 | 20 | /** 21 | * Null session. 22 | * Does not record any events or write to anything. 23 | * Useful for testing the performance impact of the framework in isolation. 24 | * 25 | * @param {!wtf.trace.TraceManager} traceManager Trace manager. 26 | * @param {!wtf.util.Options} options Options. 27 | * @constructor 28 | * @extends {wtf.trace.Session} 29 | */ 30 | wtf.trace.sessions.NullSession = function(traceManager, options) { 31 | goog.base(this, traceManager, options, 0); 32 | }; 33 | goog.inherits(wtf.trace.sessions.NullSession, wtf.trace.Session); 34 | 35 | 36 | /** 37 | * @override 38 | */ 39 | wtf.trace.sessions.NullSession.prototype.nextChunk = function() { 40 | return null; 41 | }; 42 | 43 | 44 | /** 45 | * @override 46 | */ 47 | wtf.trace.sessions.NullSession.prototype.retireChunk = goog.nullFunction; 48 | -------------------------------------------------------------------------------- /src/wtf/trace/zone.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Zone tracking utility. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.trace.Zone'); 15 | 16 | 17 | 18 | /** 19 | * Zone tracking utility. 20 | * 21 | * @param {number} zoneId Zone ID. 22 | * @param {number} timestamp Time the zone was created. 23 | * @param {string} name Zone name. 24 | * @param {string|wtf.data.ZoneType} type Zone type. 25 | * @param {string} location Zone location (such as URI of the script). 26 | * @constructor 27 | */ 28 | wtf.trace.Zone = function(zoneId, timestamp, name, type, location) { 29 | /** 30 | * Zone ID. 31 | * @type {number} 32 | */ 33 | this.id = zoneId; 34 | 35 | /** 36 | * Time the zone was created. 37 | * @type {number} 38 | */ 39 | this.timestamp = timestamp; 40 | 41 | /** 42 | * Human-readable zone name. 43 | * @type {string} 44 | */ 45 | this.name = name; 46 | 47 | /** 48 | * Zone type. 49 | * May be one of {@see wtf.data.ZoneType} or a custom value. 50 | * @type {string|wtf.data.ZoneType} 51 | */ 52 | this.type = type; 53 | 54 | /** 55 | * Zone location (such as URI of the script). 56 | * @type {string} 57 | */ 58 | this.location = location; 59 | }; 60 | -------------------------------------------------------------------------------- /src/wtf/ui/errordialog.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Error dialog CSS. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | .uiErrorDialog { 15 | width: 400px; 16 | height: 300px; 17 | 18 | .buttonClose {} 19 | 20 | .contents { 21 | .allowSelect(); 22 | 23 | .message { 24 | font-weight: bold; 25 | padding-bottom: 5px; 26 | .allowSelect(); 27 | } 28 | .details { 29 | .allowSelect(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/wtf/ui/errordialog.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Error dialog DOM. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | {namespace wtf.ui.errordialog} 15 | 16 | 17 | /** 18 | * Root control UI. 19 | * @param message Error message. 20 | * @param detail Detailed information. 21 | */ 22 | {template .control} 23 |
24 |
25 |
26 | OK 27 |
28 |

Error

29 |
30 |
31 |
{$message}
32 |
{$detail|noAutoescape}
33 |
34 |
35 | tracing-framework github,  36 | issues 37 |
38 |
39 | {/template} 40 | -------------------------------------------------------------------------------- /src/wtf/ui/progressdialog.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Progress dialog CSS. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | .uiProgressDialog { 15 | width: 450px; 16 | margin: 10px; 17 | 18 | .taskName { 19 | max-width: 324px; 20 | overflow: hidden; 21 | white-space: nowrap; 22 | text-overflow: ellipsis; 23 | line-height: 18px; 24 | } 25 | 26 | .list { 27 | margin-top: 25px; 28 | margin-bottom: 35px; 29 | } 30 | 31 | .progress { 32 | left: 50%; 33 | position: relative; 34 | margin-left: -170px; 35 | margin-top: 15px; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/wtf/ui/progressdialog.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Progress dialog DOM. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | {namespace wtf.ui.progressdialog} 15 | 16 | 17 | /** 18 | * Root control UI. 19 | * @param title Dialog title. 20 | */ 21 | {template .control} 22 |
23 |

24 | {$title} 25 |

26 |
27 |
28 |
29 | {/template} 30 | 31 | 32 | /** 33 | * Task entry template. 34 | * @param taskName Task name. 35 | */ 36 | {template .task} 37 |
38 | {if $taskName} 39 |
{$taskName}
40 | {/if} 41 |
42 |
43 |
44 |

0% complete.

45 |
46 | {/template} 47 | -------------------------------------------------------------------------------- /src/wtf/ui/styles/common.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @author benvanik@google.com (Ben Vanik) 10 | */ 11 | 12 | .fitParent { 13 | position: absolute; 14 | left: 0; 15 | right: 0; 16 | top: 0; 17 | bottom: 0; 18 | } 19 | .fitParentRelative { 20 | position: relative; 21 | left: 0; 22 | right: 0; 23 | top: 0; 24 | bottom: 0; 25 | } 26 | 27 | .floatClear { 28 | float: left; 29 | clear: both; 30 | } 31 | .clear { 32 | zoom: 1; 33 | &:after { 34 | clear: both; 35 | height: 0; 36 | display: block; 37 | visibility: hidden; 38 | content: '.'; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/wtf/ui/timepainter.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Time range painting context. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.ui.TimePainter'); 15 | 16 | goog.require('wtf.db.Unit'); 17 | goog.require('wtf.ui.Painter'); 18 | 19 | 20 | 21 | /** 22 | * Paints a time range into the view. 23 | * @param {!HTMLCanvasElement} canvas Canvas element. 24 | * @constructor 25 | * @extends {wtf.ui.Painter} 26 | */ 27 | wtf.ui.TimePainter = function(canvas) { 28 | goog.base(this, canvas); 29 | 30 | /** 31 | * Left-most visible time. 32 | * @type {number} 33 | * @protected 34 | */ 35 | this.timeLeft = 0; 36 | 37 | /** 38 | * Right-most visible time. 39 | * @type {number} 40 | * @protected 41 | */ 42 | this.timeRight = 0; 43 | 44 | /** 45 | * Units to display labels in. 46 | * @type {wtf.db.Unit} 47 | * @protected 48 | */ 49 | this.units = wtf.db.Unit.TIME_MILLISECONDS; 50 | }; 51 | goog.inherits(wtf.ui.TimePainter, wtf.ui.Painter); 52 | 53 | 54 | /** 55 | * Sets the visible time range. 56 | * @param {number} timeLeft Left-most visible time. 57 | * @param {number} timeRight Right-most visible time. 58 | */ 59 | wtf.ui.TimePainter.prototype.setTimeRange = function(timeLeft, timeRight) { 60 | this.timeLeft = timeLeft; 61 | this.timeRight = timeRight; 62 | }; 63 | 64 | 65 | /** 66 | * @return {boolean} True if the time range is valid for painting. 67 | */ 68 | wtf.ui.TimePainter.prototype.isTimeRangeValid = function() { 69 | return this.timeLeft != this.timeRight; 70 | }; 71 | 72 | 73 | /** 74 | * Sets the units the painter draws labels in. 75 | * @param {wtf.db.Unit} value Units. 76 | */ 77 | wtf.ui.TimePainter.prototype.setUnits = function(value) { 78 | this.units = value; 79 | }; 80 | -------------------------------------------------------------------------------- /src/wtf/ui/tooltip.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @author benvanik@google.com (Ben Vanik) 10 | */ 11 | 12 | .uiTooltip { 13 | position: absolute; 14 | color: white; 15 | background-color: rgba(0,0,0,0.7); 16 | padding: 5px; 17 | white-space: pre; 18 | pointer-events: none; 19 | } 20 | -------------------------------------------------------------------------------- /src/wtf/ui/ui.less: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Main app UI LESS file. 10 | * This is the root file built into the CSS used by the app. 11 | * 12 | * @author benvanik@google.com (Ben Vanik) 13 | */ 14 | 15 | @import "wtf/ui/styles/css3.less"; 16 | @import "wtf/ui/styles/common.less"; 17 | @import "wtf/ui/styles/kennedy.less"; 18 | 19 | @import "wtf/ui/dialog.less"; 20 | @import "wtf/ui/errordialog.less"; 21 | @import "wtf/ui/progressdialog.less"; 22 | @import "wtf/ui/settingsdialog.less"; 23 | @import "wtf/ui/tooltip.less"; 24 | @import "wtf/ui/virtualtable.less"; 25 | -------------------------------------------------------------------------------- /src/wtf/ui/virtualtable.soy: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * Virtual table DOM. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | {namespace wtf.ui.virtualtable} 15 | 16 | 17 | /** 18 | * Root control UI. 19 | */ 20 | {template .control} 21 |
22 | 23 |
24 |
25 |
26 |
27 |
28 |
29 | {/template} 30 | -------------------------------------------------------------------------------- /src/wtf/ui/zoom/zoom.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Common zoom types. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | goog.provide('wtf.ui.zoom.TransitionMode'); 15 | 16 | 17 | /** 18 | * Transition mode. 19 | * @enum {number} 20 | */ 21 | wtf.ui.zoom.TransitionMode = { 22 | /** 23 | * Transition over time with the default animation duration. 24 | */ 25 | ANIMATED: 0, 26 | 27 | /** 28 | * Transition immediately, with no animation. 29 | */ 30 | IMMEDIATE: 1 31 | }; 32 | -------------------------------------------------------------------------------- /src/wtf/version.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview WTF version utilities. 10 | * The versions set in this file come from {@code scripts/update-version.sh} and 11 | * should not be set manually. 12 | * 13 | * @author benvanik@google.com (Ben Vanik) 14 | */ 15 | 16 | goog.provide('wtf.version'); 17 | 18 | 19 | /** 20 | * Gets the current build number as an integer value. 21 | * This can be used to compare two build numbers using normal integer 22 | * comparison. If you need a human-readable build number, use {@see #toString}. 23 | * @return {number} Build number, as an integer. 24 | */ 25 | wtf.version.getValue = function() { 26 | // Set via update-version.sh 27 | return 1436947200000; // time 28 | }; 29 | 30 | 31 | /** 32 | * Gets the git SHA of the commit this build was taken at. 33 | * @return {string} A git SHA. 34 | */ 35 | wtf.version.getCommit = function() { 36 | // Set via update-version.sh 37 | return 'b42eb485660d79fd6756d34835427a8b39170227'; // sha 38 | }; 39 | 40 | 41 | /** 42 | * Gets the version as a human-readable string that matches the version string 43 | * used elsewhere, such as {@code 2012.12.12-2}. 44 | * @return {string} Version string. 45 | */ 46 | wtf.version.toString = function() { 47 | // Set via update-version.sh 48 | return '2015.7.15-1'; // string 49 | }; 50 | 51 | 52 | goog.exportSymbol( 53 | 'wtf.version.getValue', 54 | wtf.version.getValue); 55 | goog.exportSymbol( 56 | 'wtf.version.getCommit', 57 | wtf.version.getCommit); 58 | goog.exportSymbol( 59 | 'wtf.version.toString', 60 | wtf.version.toString); 61 | -------------------------------------------------------------------------------- /test/benchmarks.js: -------------------------------------------------------------------------------- 1 | // Generated file; see update-benchmarks.sh for more information. 2 | var benchmarkList = [ 3 | 'scopes.js', 4 | 'simple.js', 5 | 'tracetypes.js', 6 | 'dom.js', 7 | ]; 8 | if (typeof exports !== 'undefined') { exports.value = benchmarkList; } 9 | -------------------------------------------------------------------------------- /test/benchmarks/dom.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Benchmark file. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | 15 | benchmark.register('dom.image', function() { 16 | new Image(); 17 | }, ['browser']); 18 | -------------------------------------------------------------------------------- /test/benchmarks/scopes.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Benchmark file. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | 15 | benchmark.register('enterScope', function() { 16 | var scope = wtf.trace.enterScope(); 17 | // 18 | wtf.trace.leaveScope(scope); 19 | }); 20 | 21 | 22 | benchmark.register('enterScopeNamed', function() { 23 | var scope = wtf.trace.enterScope('hello'); 24 | // 25 | wtf.trace.leaveScope(scope); 26 | }); 27 | 28 | 29 | var customScopeEvent = wtf.trace.events.createScope('customScope()'); 30 | benchmark.register('customScope', function() { 31 | var scope = customScopeEvent(); 32 | // 33 | wtf.trace.leaveScope(scope); 34 | }); 35 | -------------------------------------------------------------------------------- /test/benchmarks/simple.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2012 Google, Inc. All Rights Reserved. 3 | * 4 | * Use of this source code is governed by a BSD-style license that can be 5 | * found in the LICENSE file. 6 | */ 7 | 8 | /** 9 | * @fileoverview Benchmark file. 10 | * 11 | * @author benvanik@google.com (Ben Vanik) 12 | */ 13 | 14 | 15 | benchmark.register('simple', function() { 16 | var scope = wtf.trace.enterScope(); 17 | // 18 | wtf.trace.leaveScope(scope); 19 | }); 20 | -------------------------------------------------------------------------------- /test/data/combined-1.wtf-json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "type": "wtf.json#header", 4 | "format_version": 2, 5 | "timebase": 10000 6 | }, 7 | { 8 | "type": "wtf.event#define", 9 | "signature": "my.custom#scopeEvent", 10 | "event_id": 1 11 | }, 12 | { 13 | "event": "wtf.zone#create", 14 | "time": 0, 15 | "args": [ 16 | 1000, 17 | "Runtime", 18 | "script", 19 | "" 20 | ] 21 | }, 22 | { 23 | "event": "wtf.zone#set", 24 | "time": 0, 25 | "args": [ 26 | 1000 27 | ] 28 | }, 29 | { 30 | "event": 1, 31 | "time": 10000 32 | }, 33 | { 34 | "event": -1, 35 | "time": 11000 36 | }, 37 | { 38 | "event": 1, 39 | "time": 12000 40 | }, 41 | { 42 | "event": -1, 43 | "time": 13000 44 | }, 45 | { 46 | "event": 1, 47 | "time": 14000 48 | }, 49 | { 50 | "event": -1, 51 | "time": 15000 52 | } 53 | ] 54 | -------------------------------------------------------------------------------- /test/data/combined-2.wtf-json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "type": "wtf.json#header", 4 | "format_version": 2, 5 | "timebase": 20000 6 | }, 7 | { 8 | "type": "wtf.event#define", 9 | "signature": "my.custom#scopeEvent2", 10 | "event_id": 2 11 | }, 12 | { 13 | "event": "wtf.zone#create", 14 | "time": 0, 15 | "args": [ 16 | 1000, 17 | "Runtime", 18 | "script", 19 | "" 20 | ] 21 | }, 22 | { 23 | "event": "wtf.zone#set", 24 | "time": 0, 25 | "args": [ 26 | 1000 27 | ] 28 | }, 29 | { 30 | "event": 2, 31 | "time": 20250 32 | }, 33 | { 34 | "event": -1, 35 | "time": 20750 36 | }, 37 | { 38 | "event": 2, 39 | "time": 22250 40 | }, 41 | { 42 | "event": -1, 43 | "time": 22750 44 | }, 45 | { 46 | "event": 2, 47 | "time": 24250 48 | }, 49 | { 50 | "event": -1, 51 | "time": 24750 52 | } 53 | ] 54 | -------------------------------------------------------------------------------- /test/data/out-of-order.wtf-json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "type": "wtf.json#header", 4 | "format_version": 2, 5 | "timebase": 1000 6 | }, 7 | { 8 | "type": "wtf.event#define", 9 | "signature": "my.custom#scopeEvent", 10 | "event_id": 1 11 | }, 12 | { 13 | "type": "wtf.event#define", 14 | "signature": "ooo", 15 | "event_id": 2 16 | }, 17 | { 18 | "event": "wtf.zone#create", 19 | "time": 0, 20 | "args": [ 21 | 1000, 22 | "Runtime", 23 | "script", 24 | "" 25 | ] 26 | }, 27 | { 28 | "event": "wtf.zone#set", 29 | "time": 0, 30 | "args": [ 31 | 1000 32 | ] 33 | }, 34 | { 35 | "event": 1, 36 | "time": 0 37 | }, 38 | { 39 | "event": -1, 40 | "time": 1000 41 | }, 42 | { 43 | "event": 1, 44 | "time": 2000 45 | }, 46 | { 47 | "event": -1, 48 | "time": 3000 49 | }, 50 | { 51 | "event": 1, 52 | "time": 4000 53 | }, 54 | { 55 | "event": -1, 56 | "time": 5000 57 | }, 58 | { 59 | "event": 2, 60 | "time": 100 61 | }, 62 | { 63 | "event": -1, 64 | "time": 900 65 | }, 66 | { 67 | "event": 1, 68 | "time": 5500 69 | }, 70 | { 71 | "event": -1, 72 | "time": 6000 73 | } 74 | ] 75 | -------------------------------------------------------------------------------- /test/nodemanual.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var wtf = require('../build-out/wtf_node_js_compiled'); 3 | wtf.trace.node.start(); 4 | var scope = wtf.trace.enterScope('hello'); 5 | for (var n = 0; n < 100000000; n++) { 6 | } 7 | wtf.trace.leaveScope(scope); 8 | -------------------------------------------------------------------------------- /test/settimeout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | WTF Test 4 | 5 |
6 |
7 |
8 | Click! 9 | 10 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/test-blank.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Cool App 5 | 6 | 7 |
8 | Your app here! 9 |
10 | 11 | 12 | -------------------------------------------------------------------------------- /test/test-db-uncompiled.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WTF DB (uncompiled) 5 | 6 | 7 | 8 | 9 | 10 | 13 | 37 |
Open the dev tools and use wtf.db to play around.
38 |
Pass ?url=some-trace.wtf-trace to create a global 'db' object with the given trace loaded already.
39 | 40 | 41 | -------------------------------------------------------------------------------- /test/test-db.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WTF DB 5 | 6 | 7 | 8 | 32 |
Open the dev tools and use wtf.db to play around.
33 |
Pass ?url=some-trace.wtf-trace to create a global 'db' object with the given trace loaded already.
34 | 35 | 36 | -------------------------------------------------------------------------------- /test/test-iframe-child.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Cool App iframe 5 | 6 | 7 |
8 | I'm an iframe! 9 | Click! 10 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /test/test-iframe.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Cool App 5 | 6 | 7 |
8 | Your app here! 9 | Click! 10 | 18 | 19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /test/test-replay.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WTF Test (replay) 5 | 13 | 14 | 15 |
16 |
17 |
18 | hi 19 |
20 | bi 21 |
22 |
23 |
24 |
25 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /test/test-scripts-body-post.js: -------------------------------------------------------------------------------- 1 | (function bodyPost() { 2 | console.log('body post'); 3 | })(); 4 | -------------------------------------------------------------------------------- /test/test-scripts-body-pre.js: -------------------------------------------------------------------------------- 1 | (function bodyPre() { 2 | console.log('body pre'); 3 | })(); 4 | -------------------------------------------------------------------------------- /test/test-scripts-head.js: -------------------------------------------------------------------------------- 1 | (function head() { 2 | console.log('head'); 3 | })(); 4 | -------------------------------------------------------------------------------- /test/test-scripts-remote.js: -------------------------------------------------------------------------------- 1 | (function remote() { 2 | console.log('remote'); 3 | })(); 4 | 5 | var someLink = document.getElementById('someLink'); 6 | someLink.onclick = function(e) { 7 | e.preventDefault(); 8 | 9 | if (window.wtf) { 10 | wtf.trace.timeStamp('hello'); 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /test/test-scripts.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Cool App 5 | 6 | 11 | 12 | 13 | 14 | 19 |
20 | Your app here! 21 | Click! 22 |
23 | 35 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /test/test-xhr.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | XHR test 5 | 6 | 7 | start 8 | 9 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /third_party/BUILD.anvil: -------------------------------------------------------------------------------- 1 | # Copyright 2012 Google Inc. All Rights Reserved. 2 | 3 | __author__ = 'benvanik@google.com (Ben Vanik)' 4 | 5 | 6 | # Third party build rules 7 | # All other BUILD files should reference rules in here instead of directly into 8 | # third_party/ subpaths. 9 | 10 | 11 | # ------------------------------------------------------------------------------ 12 | # Third Party 13 | # ------------------------------------------------------------------------------ 14 | 15 | # Closure Library JS files 16 | file_set( 17 | name='all_closure_js', 18 | srcs= 19 | glob('closure-library/closure/goog/**/*.js') + 20 | glob('closure-library/third_party/closure/goog/**/*.js') + 21 | ['closure-templates/soyutils_usegoog.js']) 22 | 23 | # Files required when deploying uncompiled builds 24 | file_set( 25 | name='closure_uncompiled_js', 26 | srcs=[ 27 | 'closure-library/closure/goog/deps.js', 28 | 'closure-library/closure/goog/bootstrap/webworkers.js', 29 | ]) 30 | 31 | # Closure Compiler JAR 32 | file_set( 33 | name='closure_compiler_jar', 34 | srcs=['closure-compiler/compiler.jar']) 35 | 36 | # Closure Stylesheets JAR 37 | file_set( 38 | name='closure_stylesheets_jar', 39 | srcs=['closure-stylesheets/closure-stylesheets.jar']) 40 | 41 | # Closure Templates JAR 42 | file_set( 43 | name='closure_templates_jar', 44 | srcs=['closure-templates/SoyToJsSrcCompiler.jar']) 45 | -------------------------------------------------------------------------------- /third_party/d3/BUILD.anvil: -------------------------------------------------------------------------------- 1 | # Copyright 2012 Google Inc. All Rights Reserved. 2 | 3 | __author__ = 'benvanik@google.com (Ben Vanik)' 4 | 5 | 6 | # D3 build rules 7 | 8 | 9 | # ------------------------------------------------------------------------------ 10 | # Third Party 11 | # ------------------------------------------------------------------------------ 12 | 13 | file_set( 14 | name='plugins', 15 | srcs=[ 16 | 'sankey.js', 17 | ]) 18 | 19 | # Debug files. 20 | concat_files( 21 | name='debug', 22 | out='d3-debug-concat.js', 23 | srcs=[ 24 | 'd3.v3.js', 25 | ':plugins', 26 | ]) 27 | 28 | # Minified files. 29 | concat_files( 30 | name='min', 31 | out='d3-min-concat.js', 32 | srcs=[ 33 | 'd3.v3.min.js', 34 | ':plugins', 35 | ]) 36 | -------------------------------------------------------------------------------- /third_party/d3/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Michael Bostock 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * The name Michael Bostock may not be used to endorse or promote products 15 | derived from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT, 21 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 24 | OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 26 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /wtfrc: -------------------------------------------------------------------------------- 1 | # Copyright 2012 Google Inc. All Rights Reserved. 2 | 3 | # Bash aliases 4 | 5 | alias anvil='./third_party/anvil-build/anvil-local.sh' 6 | 7 | alias deployext='anvil deploy -o build-bin/ extensions/wtf-injector-chrome:deploy extensions/wtf-injector-firefox:deploy' 8 | alias deployzip='anvil deploy -o build-bin/ :injector' 9 | --------------------------------------------------------------------------------