2016-04-08 Ryosuke Niwa Build fix. We need to escape the path or http.request would fail. * tools/js/remote.js: 2016-04-08 Ryosuke Niwa Fix various bugs in the new syncing script https://bugs.webkit.org/show_bug.cgi?id=156393 Reviewed by Darin Adler. * server-tests/resources/common-operations.js: Added. This file was supposed to be added in r199191. (addBuilderForReport): (addSlaveForReport): (connectToDatabaseInEveryTest): (submitReport): * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._pullBuildbotOnAllSyncers): Don't log every time we pull from buildbot builder as this dramatically increases the amount of log we generate. * tools/js/parse-arguments.js: (parseArguments): Fixed a typo. This should be parseArgument*s*, not parseArgument. * tools/js/remote.js: (RemoteAPI.prototype.url): Fixed a bug that portSuffix wasn't being expanded in the template literal. (RemoteAPI.prototype.configure): Added more validations with nice error messages. (RemoteAPI.prototype.sendHttpRequest): Falling back to port 80 isn't right when scheme is https. Compute the right port in configure instead based on the scheme. * tools/sync-buildbot.js: (syncLoop): Fixed the bug that syncing multiple times fail because Manifest.fetch() create new Platform and Test objects. This results in various references in BuildRequest objects to get outdated. Fixing this properly in Manifest.fetch() because we do need to "forget" about some tests and platforms in some cases. For now, delete all v3 model objects and start over in each syncing cycle. * unit-tests/tools-js-remote-tests.js: Added. Unit tests for the aforementioned changes to RemoteAPI. 2016-04-07 Ryosuke Niwa sync-buildbot.js doesn't mark disappeared builds as failed https://bugs.webkit.org/show_bug.cgi?id=156386 Reviewed by Chris Dumez. Fix a bug that new syncing script doesn't mark builds that it scheduled but doesn't appear when queried by buildbot's JSON API. These are builds that got canceled by humans (e.g. buildbot was restarted, data loss, pending build was canceled, etc...) * server-tests/tools-buildbot-triggerable-tests.js: Added a test case. * tools/js/buildbot-triggerable.js: (BuildbotTriggerable.prototype._pullBuildbotOnAllSyncers): Added a set of build requests we've matched against BuildbotBuildEntry's. Mark build requests that didn't have any entry but supposed to be in either 'scheduled' or 'running' status as failed. 2016-04-07 Ryosuke Niwa A/B testing bots should prioritize user created test groups https://bugs.webkit.org/show_bug.cgi?id=156375 Reviewed by Chris Dumez. Order build requests preferring user created ones over ones automatically created by detect-changes.js. Also fixed a bug in BuildbotSyncer.scheduleFirstRequestInGroupIfAvailable that it was scheduling a new build request on a builder/slave even when we had previously scheduled another build request. * public/include/build-requests-fetcher.php: (BuildRequestsFetcher::fetch_incomplete_requests_for_triggerable): Order build requested based on author_order which is 0 when it's created by an user and 1 when it's created by detect-changes.js. Since we're using ascending order, this would put user created test groups first. * server-tests/api-build-requests-tests.js: Updated an existing test case and added a new test case for testing that build requests for an user created test group shows up first. * server-tests/resources/mock-data.js: (MockData.addAnotherMockTestGroup): Takes an extra argument to specify the author name. * server-tests/tools-buildbot-triggerable-tests.js: Added a test case for testing that build requests for an user created test group shows up first. * tools/js/buildbot-syncer.js: (BuildbotSyncer): Added _slavesWithNewRequests to keep track of build slaves on which we have already scheduled new build requests. Don't schedule more requests on these slaves. (BuildbotSyncer.prototype.scheduleRequest): (BuildbotSyncer.prototype.scheduleFirstRequestInGroupIfAvailable): Add the specified slave name (or null when slaveList is not specified) to _slavesWithNewRequests. (BuildbotSyncer.prototype.pullBuildbot): Clear the set after pulling buildbot since any build request we have previously scheduled should be included in one of the entires now. * unit-tests/buildbot-syncer-tests.js: Added test cases for the aforementioned bug. (sampleiOSConfig): Added a second slave for new test cases. 2016-04-07 Ryosuke Niwa Migrate legacy perf dashboard tests to mocha.js based tests https://bugs.webkit.org/show_bug.cgi?id=156335 Reviewed by Chris Dumez. Migrated all legacy run-tests.js tests to mocha.js based tests. Since the new harness uses Promise for most of asynchronous operations, refactored the tests to use Promises as well, and added more assertions where appropriate. Also consolidated common helper functions into server-tests/resources/common-operations.js. Unfortunately there were multiple inconsistent implementations of addBuilder/addSlave. Some were taking an array of reports while others were taking a single report. New shared implementation in common-operations.js now takes a single report. Also decreased the timeout in most tests from 10s to 1s so that tests fail early when they timeout. Most of tests are passing under 100ms on my computer so 1s should be plenty still. * run-tests.js: Removed. * server-tests/admin-platforms-tests.js: Moved from tests/admin-platforms.js. (reportsForDifferentPlatforms): * server-tests/admin-reprocess-report-tests.js: Moved from tests/admin-reprocess-report.js. (.addBuilder): Moved to common-operations.js. * server-tests/api-build-requests-tests.js: * server-tests/api-manifest.js: Use MockData.resetV3Models() instead of manually clearing maps. * server-tests/api-measurement-set-tests.js: Moved from tests/api-measurement-set.js. (.queryPlatformAndMetric): (.format): * server-tests/api-report-commits-tests.js: Moved from tests/api-report-commits.js. * server-tests/api-report-tests.js: Moved from tests/api-report.js. (.emptyReport): (.emptySlaveReport): (.reportWithSameSubtestName): * server-tests/resources/common-operations.js: Added. (addBuilderForReport): Extracted from tests. (addSlaveForReport): Ditto. (connectToDatabaseInEveryTest): Added. (submitReport): Extracted from admin-platforms-tests.js. * server-tests/resources/test-server.js: (TestServer): Make TestServer a singleton since it doesn't make any sense for each module to start its own Apache instance (that would certainly will fail). * server-tests/tools-buildbot-triggerable-tests.js: * tests: Removed. * tools/js/database.js: (Database.prototype.selectAll): Added. (Database.prototype.selectFirstRow): Added. (Database.prototype.selectRows): Added. Dynamically construct a query string based on arguments. 2016-04-05 Ryosuke Niwa New buildbot syncing scripts that supports multiple builders and slaves https://bugs.webkit.org/show_bug.cgi?id=156269 Reviewed by Chris Dumez. Add sync-buildbot.js that supports scheduling A/B testing jobs on multiple builders and slaves. The old python script (sync-with-buildbot.py) could only support a single builder and slave for each platform, test pair. The main logic is implemented in BuildbotTriggerable.syncOnce. Various helper methods are added throughout the codebase and tests have been refactored. BuildbotSyncer has been updated to support multiple platform, test pairs. It's now responsible for syncing everything on each builder (on a buildbot). Added more unit tests for BuildbotSyncer and server tests for BuildbotTriggerable, and refactored test helpers and mocks as needed. * public/v3/models/build-request.js: (BuildRequest.prototype.status): Added. (BuildRequest.prototype.isScheduled): Added. * public/v3/models/metric.js: (Metric.prototype.fullName): Added. * public/v3/models/platform.js: (Platform): Added the map based on platform name. (Platform.findByName): Added. * public/v3/models/test.js: (Test.topLevelTests): (Test.findByPath): Added. Finds a test based on an array of test names; e.g. ['A', 'B'] would find the test whose name is "B" which has a parent test named "A". (Test.prototype.fullName): Added. * server-tests/api-build-requests-tests.js: (addMockData): Moved to resources/mock-data.js. (addAnotherMockTestGroup): Ditto. * server-tests/resources/mock-data.js: Added. (MockData.resetV3Models): Added. (MockData.addMockData): Moved from api-build-requests-tests.js. (MockData.addAnotherMockTestGroup): Ditto. (MockData.mockTestSyncConfigWithSingleBuilder): Added. (MockData.mockTestSyncConfigWithTwoBuilders): Added. (MockData.pendingBuild): Added. (MockData.runningBuild): Added. (MockData.finishedBuild): Added. * server-tests/resources/test-server.js: (TestServer): (TestServer.prototype.remoteAPI): (TestServer.prototype._ensureTestDatabase): Don't fail even if the test database doesn't exit. (TestServer.prototype._startApache): Create a RemoteAPI instance to access the test sever. (TestServer.prototype._waitForPid): Increase the timeout. (TestServer.prototype.inject): Replace global.RemoteAPI during the test and restore it afterwards. * server-tests/tools-buildbot-triggerable-tests.js: Added. Tests BuildbotTriggerable.syncOnce. (MockLogger): Added. (MockLogger.prototype.log): Added. (MockLogger.prototype.error): Added. * tools/detect-changes.js: (parseArgument): Moved to js/parse-arguments.js. * tools/js/buildbot-syncer.js: (BuildbotBuildEntry): (BuildbotBuildEntry.prototype.syncer): Added. (BuildbotBuildEntry.prototype.buildRequestStatusIfUpdateIsNeeded): Added. Returns a new status for a build request (of the matching build request ID) if it needs to be updated in the server. (BuildbotSyncer): This class (BuildbotSyncer.prototype.addTestConfiguration): Added. (BuildbotSyncer.prototype.testConfigurations): Returns the list of test configurations. (BuildbotSyncer.prototype.matchesConfiguration): Returns true iff the request can be scheduled on this builder. (BuildbotSyncer.prototype.scheduleRequest): Added. Schedules a new job on buildbot for a request. (BuildbotSyncer.prototype.scheduleFirstRequestInGroupIfAvailable): Added. Schedules a new job for the specified build request on the first slave that's available. (BuildbotSyncer.prototype.pullBuildbot): Return a list of BuildbotBuildEntry instead of an object. Also store it on an instance variable so that scheduleFirstRequestInGroupIfAvailable could use it. (BuildbotSyncer.prototype._pullRecentBuilds): (BuildbotSyncer.prototype.pathForPendingBuildsJSON): Renamed from urlForPendingBuildsJSON and now only returns the path instead of the full URL since RemoteAPI takes a path, not full URL. (BuildbotSyncer.prototype.pathForBuildJSON): Ditto from pathForBuildJSON. (BuildbotSyncer.prototype.pathForForceBuild): Added. (BuildbotSyncer.prototype.url): Use RemoteAPI's url method instead of manually constructing URL. (BuildbotSyncer.prototype.urlForBuildNumber): Ditto. (BuildbotSyncer.prototype._propertiesForBuildRequest): Now that each syncer can have multiple test configurations associated with it, find the one matching for this request. (BuildbotSyncer._loadConfig): Create a syncer per builder and add all test configurations to it. (BuildbotSyncer._validateAndMergeConfig): Added the support for 'SlaveList', which is a list of slave names present on this builder. * tools/js/buildbot-triggerable.js: Added. (BuildbotTriggerable): Added. (BuildbotTriggerable.prototype.name): Added. (BuildbotTriggerable.prototype.syncOnce): Added. The main logic for the syncing script. It pulls existing build requests from the perf dashboard, pulls buildbot for pending and running/completed builds on each builder (represented by each syncer), schedules build requests on buildbot if there is any builder/slave available, and updates the status of build requests in the database. (BuildbotTriggerable.prototype._validateRequests): Added. (BuildbotTriggerable.prototype._pullBuildbotOnAllSyncers): Added. (BuildbotTriggerable.prototype._scheduleNextRequestInGroupIfSlaveIsAvailable): Added. (BuildbotTriggerable._testGroupMapForBuildRequests): Added. * tools/js/database.js: * tools/js/parse-arguments.js: Added. Extracted out of tools/detect-changes.js. (parseArguments): * tools/js/remote.js: (RemoteAPI): Now optionally takes the server configuration. (RemoteAPI.prototype.url): Added. (RemoteAPI.prototype.getJSON): Removed the code for specifying request content. (RemoteAPI.prototype.getJSONWithStatus): Ditto. (RemoteAPI.prototype.postJSON): Added. (RemoteAPI.prototype.postFormUrlencodedData): Added. (RemoteAPI.prototype.sendHttpRequest): Fixed the code to specify auth. * tools/js/v3-models.js: Don't include RemoteAPI here as they require a configuration for each host. * tools/sync-buildbot.js: Added. (main): Added. Parse the arguments and start the loop. (syncLoop): Added. * unit-tests/buildbot-syncer-tests.js: Added tests for pullBuildbot, scheduleRequest, as well as scheduleFirstRequestInGroupIfAvailable. Refactored helper functions as needed. (sampleiOSConfig): (smallConfiguration): Added. (smallPendingBuild): Added. (smallInProgressBuild): Added. (smallFinishedBuild): Added. (createSampleBuildRequest): Create a unique build request for each platform. (samplePendingBuild): Optionally specify build time and slave name. (sampleInProgressBuild): Optionally specify slave name. (sampleFinishedBuild): Ditto. * unit-tests/resources/mock-remote-api.js: (assert.notReached.assert.notReached): (MockRemoteAPI.url): Added. (MockRemoteAPI.postFormUrlencodedData): Added. (MockRemoteAPI._addRequest): Extracted from getJSONWithStatus. (MockRemoteAPI.waitForRequest): Extracted from inject. For tools-buildbot-triggerable-tests.js, we need to instantiate a RemoteAPI for buildbot without replacing global.RemoteAPI. (MockRemoteAPI.inject): (MockRemoteAPI.reset): Added. 2016-03-30 Ryosuke Niwa Simplify API of Test model by removing Test.setParentTest https://bugs.webkit.org/show_bug.cgi?id=156055 Reviewed by Joseph Pecoraro. Removed Test.setParentTest. Keep track of the child-parent relationship using the static map instead. Now each test only stores parent's id and uses the ID static map in Test.parentTest(). * public/v3/models/manifest.js: (Manifest._didFetchManifest.buildObjectsFromIdMap): Removed the code to create the map of child-parent relationship and call setParentTest. * public/v3/models/test.js: (Test): Updated a static map by the name of "childTestMap" to store itself. We should probably sort child tests using some fixed criteria in the future instead of relying on the creation order but preserve the old code's ordering for now. (Test.prototype.parentTest): Look up the static map by the parent test's id. (Test.prototype.onlyContainsSingleMetric): (Test.prototype.setParentTest): Deleted. (Test.prototype.childTests): Look up the child test map. 2016-03-30 Ryosuke Niwa BuildRequest should have associated platform and test https://bugs.webkit.org/show_bug.cgi?id=156054 Reviewed by Joseph Pecoraro. Added methods to retrieve the platform and the test associated with a build request with tests. * public/v3/models/build-request.js: (BuildRequest): (BuildRequest.prototype.platform): Added. (BuildRequest.prototype.test): Added. * server-tests/api-build-requests-tests.js: * server-tests/api-manifest.js: Fixed a typo. This tests /api/manifest, not /api/build-requests. * unit-tests/buildbot-syncer-tests.js: (.createSampleBuildRequest): Now takes Platform and Test objects to avoid hitting assertions in BuildRequest's constructor. 2016-03-30 Ryosuke Niwa BuildRequest should have a method to fetch all in-progress and pending requests for a triggerable https://bugs.webkit.org/show_bug.cgi?id=156008 Reviewed by Darin Adler. Add a method to BuildRequest that fetches all pending and in-progress requests for a triggerable. Now, new syncing scripts must be able to figure out the build slave the first build requests in a given test group had used in order to schedule subsequent build requests in the test group. For this purpose, /api/build-requests has been modified to return all build requests whose test group had not finished yet. A test group is finished if all build requests in the test group had finished (completed, failed, or canceled). * public/include/build-requests-fetcher.php: (BuildRequestFetcher::fetch_incomplete_requests_for_triggerable): Return all build requests in test groups that have not been finished. * public/v3/models/build-request.js: (BuildRequest): (BuildRequest.prototype.testGroupId): Added. (BuildRequest.prototype.isPending): Renamed from hasPending to fix a bad grammar. (BuildRequest.fetchForTriggerable): Added. (BuildRequest.constructBuildRequestsFromData): Extracted from _createModelsFromFetchedTestGroups in TestGroup. * public/v3/models/manifest.js: (Manifest.fetch): Use the full path from root so that it works in server tests. * public/v3/models/test-group.js: (TestGroup.hasPending): (TestGroup._createModelsFromFetchedTestGroups): * server-tests/api-build-requests-tests.js: Added tests to ensure all build requests for a test group is present in the response returned by /api/build-requests iff any build request in the group had not finished yet. (.addMockData): (.addAnotherMockTestGroup): Added. * unit-tests/test-groups-tests.js: 2016-03-29 Ryosuke Niwa Make dependency injection in unit tests more explicit https://bugs.webkit.org/show_bug.cgi?id=156006 Reviewed by Joseph Pecoraro. Make the dependency injection of model objects in unit tests explicit so that server tests that create "real" model objects won't create these mock objects. Now each test that uses mock model objects would call MockModels.inject() to inject before / beforeEach and access each object using a property on MockModels instead of them being implicitly defined on the global object. Similarly, MockRemoteAPI now only replaces global.RemoteAPI during each test so that server tests can use real RemoteAPI to access the test Apache server. * unit-tests/analysis-task-tests.js: * unit-tests/buildbot-syncer-tests.js: (createSampleBuildRequest): * unit-tests/measurement-adaptor-tests.js: * unit-tests/measurement-set-tests.js: * unit-tests/resources/mock-remote-api.js: (MockRemoteAPI.getJSONWithStatus): (MockRemoteAPI.inject): Added. Override RemoteAPI on the global object during each test. * unit-tests/resources/mock-v3-models.js: (MockModels.inject): Added. Create mock model objects before each test, and clear all static maps of various v3 model classes (to remove all singleton objects for those model classes). * unit-tests/test-groups-tests.js: 2016-03-29 Ryosuke Niwa BuildbotSyncer should be able to fetch JSON from buildbot https://bugs.webkit.org/show_bug.cgi?id=155921 Reviewed by Joseph Pecoraro. Added BuildbotSyncer.pullBuildbot which fetches pending, in-progress, and finished builds from buildbot with lots of unit tests as this has historically been a source of subtle bugs in the old script. New implementation fixes a subtle bug in the old pythons script which overlooked the possibility that the state of some builds may change between each HTTP request. In the old script, we fetched the list of the pending builds, and requested -1, -2, etc... builds for N times. But between each request, a pending build may start running or an in-progress build finish and shift the offset by one. The new script avoids this problem by first requesting all pending builds, then all in-progress and finished builds in a single HTTP request. The results are then merged so that entries for in-progress and finished builds would override the entries for pending builds if they overlap. Also renamed RemoteAPI.fetchJSON to RemoteAPI.getJSON to match v3 UI's RemoteAPI. This change makes the class interchangeable between frontend (public/v3/remote.js) and backend (tools/js/remote.js). * server-tests/api-build-requests-tests.js: * server-tests/api-manifest.js: * tools/js/buildbot-syncer.js: (BuildbotBuildEntry): Removed the unused argument "type". Store the syncer as an instance variable as we'd need to query for the buildbot URL. Also fixed a bug that _isInProgress was true for finished builds as 'currentStep' is always defined but null in those builds. (BuildbotBuildEntry.prototype.buildNumber): Added. (BuildbotBuildEntry.prototype.isPending): Added. (BuildbotBuildEntry.prototype.hasFinished): Added. (BuildbotSyncer.prototype.pullBuildbot): Added. Fetches pending builds first and then finished builds. (BuildbotSyncer.prototype._pullRecentBuilds): Added. Fetches in-progress and finished builds. (BuildbotSyncer.prototype.urlForPendingBuildsJSON): Added. (BuildbotSyncer.prototype.urlForBuildJSON): Added. (BuildbotSyncer.prototype.url): Added. (BuildbotSyncer.prototype.urlForBuildNumber): Added. * tools/js/remote.js: (RemoteAPI.prototype.getJSON): Renamed from fetchJSON. (RemoteAPI.prototype.getJSONWithStatus): Renamed from fetchJSONWithStatus. * tools/js/v3-models.js: Load tools/js/remote.js instead of public/v3/remote.js inside node. * unit-tests/buildbot-syncer-tests.js: Added a lot of unit tests for BuildbotSyncer.pullBuildbot (samplePendingBuild): (sampleInProgressBuild): Added. (sampleFinishedBuild): Added. * unit-tests/resources/mock-remote-api.js: (global.RemoteAPI.getJSON): Use the same mock as getJSONWithStatus. 2016-03-24 Ryosuke Niwa Migrate admin-regenerate-manifest.js to mocha.js and test v3 UI code https://bugs.webkit.org/show_bug.cgi?id=155863 Reviewed by Joseph Pecoraro. Replaced admin-regenerate-manifest.js by a new mocha.js tests using the new server testing capability added in r198642 and tested v3 UI code (parsing manifest.json and creating models). Also removed /admin/regenerate-manifest since it has been superseded by /api/manifest. This patch also extracts manifest.js out of main.js so that it could be used and tested without the DOM support in node. * public/admin/regenerate-manifest.php: Deleted. * public/include/db.php: Fixed a regression from r198642 since CONFIG_DIR now doesn't end with a trailing backslash. * public/include/manifest.php: (ManifestGenerator::bug_trackers): Avoid a warning message when there are no repositories. * public/v3/index.html: * public/v3/main.js: (main): * public/v3/models/bug-tracker.js: (BugTracker.prototype.newBugUrl): Added. (BugTracker.prototype.repositories): Added. * public/v3/models/manifest.js: Added. Extracted from main.js. (Manifest.fetch): Moved from main.js' fetchManifest. (Manifest._didFetchManifest): Moved from main.js' didFetchManifest. * public/v3/models/platform.js: (Platform.prototype.hasTest): Fixed the bug that "test" here was shadowing the function parameter of the same name. This is tested by the newly added test cases. * server-tests/api-build-requests-tests.js: * server-tests/api-manifest.js: Added. Migrated test cases from tests/admin-regenerate-manifest.js with additional assertions for v3 UI model objects. * server-tests/resources/test-server.js: (TestServer.prototype.start): (TestServer.prototype.testConfig): Renamed from _constructTestConfig now that this is a public API. Also no longer takes dataDirectory as an argument since it's always the same. (TestServer.prototype._ensureDataDirectory): Fixed a bug that we weren't making public/data. (TestServer.prototype.cleanDataDirectory): Added. Remove all files inside public/data between tests. (TestServer.prototype.inject): Added. Calls before, etc... because always calling before had an unintended side effect of slowing down unit tests even through they don't need Postgres or Apache. * tests/admin-regenerate-manifest.js: Removed. * tools/js/database.js: * tools/js/v3-models.js: 2016-03-23 Ryosuke Niwa Add mocha server tests for /api/build-requests https://bugs.webkit.org/show_bug.cgi?id=155831 Reviewed by Chris Dumez. Added the new mocha.js based server-tests for /api/build-requests. The new harness automatically: - starts a new Apache instance - switches the database during testing via setting an environmental variable - backups and restores public/data directory during testing As a result, developer no longer has to manually setup Apache, edit config.json manually to use a testing database, or run /api/manifest.php to re-generate the manifest file after testing. This patch also makes ID resolution optional on /api/build-requests so that v3 model based syncing scripts can re-use the same code as the v3 UI to process the JSON. tools/sync-with-buildbot.py has been modified to use this option (useLegacyIdResolution). * config.json: Added configurations for the test httpd server. * init-database.sql: Don't error when tables and types don't exist (when database is empty). * public/api/build-requests.php: (main): Made the ID resolution optional with useLegacyIdResolution. Also removed "updates" from the results JSON since it's never used. * public/include/build-requests-fetcher.php: (BuildRequestsFetcher::__construct): (BuildRequestsFetcher::fetch_roots_for_set_if_needed): Fixed the bug that we would include the same commit multiple times for each root set. * public/include/db.php: (config): If present, use ORG_WEBKIT_PERF_CONFIG_PATH instead of Websites/perf.webkit.org/config.json. * server-tests: Added. * server-tests/api-build-requests-tests.js: Added. Tests for /api/build-requests. (.addMockData): * server-tests/resources: Added. * server-tests/resources/test-server.conf: Added. Apache configuration file for testing. * server-tests/resources/test-server.js: Added. (TestSever): Added. (TestSever.prototype.start): Added. (TestSever.prototype.stop): Added. (TestSever.prototype.remoteAPI): Added. Configures RemoteAPI to be used with the test sever. (TestSever.prototype.database): Added. Returns Database configured to use the test database. (TestSever.prototype._constructTestConfig): Creates config.json for testing. The file is generated by _start and db.php's config() reads it from the environmental variable: ORG_WEBKIT_PERF_CONFIG_PATH. (TestSever.prototype._ensureDataDirectory): Renames public/data to public/original-data if exists, and creates a new empty public/data. (TestSever.prototype._restoreDataDirectory): Deletes public/data and renames public/original-data back to public/data. (TestSever.prototype._ensureTestDatabase): Drops the test database if exists and creates a new one. (TestSever.prototype.initDatabase): Run init-database.sql to start each test with a consistent state. (TestSever.prototype._executePgsqlCommand): Executes a postgres command line tool such as psql. (TestSever.prototype._determinePgsqlDirectory): Finds the directory that contains psql. (TestSever.prototype._startApache): Starts an Apache instance for testing. (TestSever.prototype._stopApache): Stops the Apache instance for testing. (TestSever.prototype._waitForPid): Waits for the Apache pid file to appear or disappear. (before): Start the test server at the beginning. (beforeEach): Re-initialize all tables before each test. (after): Stop the test server at the end. * tools/js/config.js: (Config.prototype.path): (Config.prototype.serverRoot): Added. The path to Websites/perf.webkit.org/public/. (Config.prototype.pathFromRoot): Added. Resolves a path from Websites/perf.webkit.org. * tools/js/database.js: (Database): Now optionally takes the database name to use a different database during testing. (Database.prototype.connect): (Database.prototype.query): Added. (Database.prototype.insert): Added. (tableToPrefixMap): Maps table name to its prefix. Used by Database.insert. * tools/js/remote.js: Added. (RemoteAPI): Added. This is node.js equivalent of RemoteAPI in public/v3/remote.js. (RemoteAPI.prototype.configure): Added. (RemoteAPI.prototype.fetchJSON): Added. (RemoteAPI.prototype.fetchJSONWithStatus): Added. (RemoteAPI.prototype.sendHttpRequest): Added. * tools/sync-with-buildbot.py: (main): Use useLegacyIdResolution as this script relies on the legacy behavior. * unit-tests/checkconfig.js: pg was never directly used in this test. 2016-03-23 Ryosuke Niwa Delete a file that was supposed to be removed in r198614 for real. * unit-tests/resources/v3-models.js: Removed. 2016-03-23 Ryosuke Niwa Add a model for parsing buildbot JSON with unit tests https://bugs.webkit.org/show_bug.cgi?id=155814 Reviewed by Joseph Pecoraro. Added BuildbotSyncer and BuildbotBuildEntry classes to parse buildbot JSON files with unit tests. They will be used in the new syncing scripts to improve A/B testing. * public/v3/models/build-request.js: (BuildRequest): * tools/js/buildbot-syncer.js: Added. (BuildbotBuildEntry): Added. (BuildbotBuildEntry.prototype.slaveName): Added. (BuildbotBuildEntry.prototype.buildRequestId): Added. (BuildbotBuildEntry.prototype.isInProgress): Added. (BuildbotSyncer): Added. (BuildbotSyncer.prototype.testPath): Added. (BuildbotSyncer.prototype.builderName): Added. (BuildbotSyncer.prototype.platformName): Added. (BuildbotSyncer.prototype.fetchPendingRequests): Added. (BuildbotSyncer.prototype._propertiesForBuildRequest): Added. (BuildbotSyncer.prototype._revisionSetFromRootSetWithExclusionList): Added. (BuildbotSyncer._loadConfig): Added. (BuildbotSyncer._validateAndMergeConfig): Added. (BuildbotSyncer._validateAndMergeProperties): Added. * tools/js/v3-models.js: Copied from unit-tests/resources/v3-models.js. (beforeEach): Deleted since this only defined inside mocha. * unit-tests/analysis-task-tests.js: * unit-tests/buildbot-syncer-tests.js: Added. (sampleiOSConfig): (createSampleBuildRequest): (.smallConfiguration): * unit-tests/measurement-adaptor-tests.js: * unit-tests/measurement-set-tests.js: * unit-tests/resources/mock-v3-models.js: Renamed from unit-tests/resources/v3-models.js. (beforeEach): * unit-tests/test-groups-tests.js: (sampleTestGroup): 2016-03-22 Ryosuke Niwa Add unit tests for test-group.js https://bugs.webkit.org/show_bug.cgi?id=155781 Reviewed by Joseph Pecoraro. Added unit tests for test-group.js that would have caught regressions fixed in r198503. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype._renderAnnotations): Added a forgotten break statement. * public/v3/models/build-request.js: (BuildRequest.prototype.setResult): (BuildRequest): * public/v3/models/test-group.js: * unit-tests/measurement-set-tests.js: Use ./resources/v3-models.js to reduce the code duplication. * unit-tests/resources/v3-models.js: Import more stuff from v3 models. (beforeEach): * unit-tests/test-groups-tests.js: Added. Added some unit tests for TestGroup. (sampleTestGroup): (.testGroupWithStatusList): 2016-03-22 Ryosuke Niwa Fix a typo. * config.json: 2016-03-21 Ryosuke Niwa Commit log viewer repaints too frequently after r198499 https://bugs.webkit.org/show_bug.cgi?id=155732 Reviewed by Joseph Pecoraro. The bug was caused by InteractiveTimeSeriesChart invoking onchange callback whenever mouse moved even if the current point didn't change. Fixed the bug by avoiding the work if the indicator hadn't changed and avoiding work in the commit log viewer when the requested repository and the revision range were the same as those of the last request. * public/v3/components/commit-log-viewer.js: (CommitLogViewer): (CommitLogViewer.prototype.currentRepository): Exit early when repository and the revision range are identical to the one we already have to avoid repaints and issuing multiple network requests. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype._mouseMove): Don't invoke _notifyIndicatorChanged if the current indicator hadn't changed. * public/v3/pages/chart-pane.js: (ChartPane.prototype._indicatorDidChange): Fixed the bug that unlocking the indicator wouldn't update the URL. We need to check whether the lock state had changed. The old condition was also redundant since _mainChartIndicatorWasLocked is always identically equal to isLocked per the prior assignment. 2016-03-21 Ryosuke Niwa Fix A/B testing after r198503. * public/include/build-requests-fetcher.php: 2016-03-21 Ryosuke Niwa Analysis task page is broken after r198479 https://bugs.webkit.org/show_bug.cgi?id=155735 Rubber-stamped by Chris Dumez. * public/api/measurement-set.php: (AnalysisResultsFetcher::fetch_commits): We need to emit the commit ID as done for regular data. * public/include/build-requests-fetcher.php: (BuildRequestsFetcher::fetch_roots_for_set_if_needed): Ditto. Don't use a fake ID after r198479. * public/v3/models/commit-log.js: (CommitLog): Assert that all commit log IDs are integers to catch regressions like this in future. * public/v3/models/root-set.js: (RootSet): Don't resolve Repository here as doing so would modify the shared "root" entry in the JSON we fetched, and subsequent construction of RootSet would fail since this line would blow up trying to find the repository with "[object]" as the ID. * public/v3/models/test-group.js: (TestGroup._createModelsFromFetchedTestGroups): Resolve Repository here. 2016-03-21 Ryosuke Niwa v3 UI sometimes don't update the list of revisions on the commit log viewer https://bugs.webkit.org/show_bug.cgi?id=155729 Rubber-stamped by Chris Dumez. Fixed multiple bugs that were affecting the list of blame range and commit logs for the range weren't updated in some cases on v3 UI. Also, the commit log viewer state is now a part of the URL state so opening and closing the commit log viewer will persist across page loads. Also fixed a regression from r198479 that Test object can't be created for a top level test. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.configure): (ChartPaneBase.prototype._mainSelectionDidChange): Fixed the bug that the list of blame range nor the commit log viewer don't get updated when the selected range changes. (ChartPaneBase.prototype._indicatorDidChange): (ChartPaneBase.prototype._didFetchData): (ChartPaneBase.prototype._updateStatus): Extracted from _indicatorDidChange and _didFetchData. (ChartPaneBase.prototype._requestOpeningCommitViewer): Renamed from _openCommitViewer. * public/v3/components/chart-status-view.js: (ChartStatusView.prototype.updateStatusIfNeeded): Fixed the bug that the blame range doesn't get set on the initial page load when the selection range is set but the chart data hadn't been fetched yet. * public/v3/components/commit-log-viewer.js: (CommitLogViewer.prototype.view): Fixed the bug that we don't clear out the old list of commits while loading the next set of commits to show as it looked as if the list was never updated. (CommitLogViewer.prototype.render): Fixed the bug that the view always show the last repository name even if there were nothing being fetched or commits to show. * public/v3/components/pane-selector.js: (PaneSelector.prototype.focus): Removed superfluous call to console.log. * public/v3/models/data-model.js: (DataModelObject.listForStaticMap): Generalized the code for all to fix the bug in Test. (DataModelObject.all): * public/v3/models/test.js: (Test): Fixed the bug that this code was relying on the static map to be an array. (Test.topLevelTests): Use newly added listForStaticMap to convert the dictionary to an array. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView): Always initialize _usedRevisionRange as a triple to simplify code elsewhere. (ChartPaneStatusView.prototype.render): Invoke _revisionCallback when user clicks on a repository expansion mark (>>). Also fixed click handler from the row since this made selecting revision range on the view cumbersome. Now user has to explicitly click on the expansion mark (>>). (ChartPaneStatusView.prototype._setRevisionRange): Now takes shouldNotify, from, and to as arguments as this function must not invoke_revisionCallback inside _updateRevisionListForNewCurrentRepository. (ChartPaneStatusView.prototype.moveRepositoryWithNotification): Use newly added setCurrentRepository instead of manually invoking setCurrentRepository and updateRevisionListWithNotification. (ChartPaneStatusView.prototype.setCurrentRepository): Fixed the bug that we weren't updating the blame list here. (ChartPaneStatusView.prototype.updateRevisionList): Renamed from updateRevisionListWithNotification since we no longer call _revisionCallback. In general, callbacks are only meant to communicate user initiated actions, and not program induced updates like this API so this was a bad pattern anyway. ChartPane now explicitly updates the commit log viewer instead of relying on this function calling _requestOpeningCommitViewer implicitly. (ChartPaneStatusView.prototype._updateRevisionListForNewCurrentRepository): Extracted from updateRevisionListWithNotification so that setCurrentRepository can also call this function. * public/v3/pages/chart-pane.js: (ChartPane.prototype._requestOpeningCommitViewer): Overrides ChartPaneBase's method. Open the same repository in other panes via ChartsPage.setOpenRepository. (ChartPane.prototype.setOpenRepository): This method is called when the user selected a repository in another pane. Open the same repository in this pane if it wasn't already open. * public/v3/pages/charts-page.js: (ChartsPage): Added this._currentRepositoryId. (ChartsPage.prototype.serializeState): Serialize _currentRepositoryId. (ChartsPage.prototype.updateFromSerializedState): Set the commit log viewer's (ChartsPage.prototype.setOpenRepository): Added. * tests/api-measurement-set.js: Fixed a test after r198479. 2016-03-21 Ryosuke Niwa V3 Perf Dashboard should automatically select initial range when creating a new task https://bugs.webkit.org/show_bug.cgi?id=155677 Reviewed by Joseph Pecoraro. Select the entire range of points for which the analysis task is created by default so that creating a test group to confirm the regression / progression is easy. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): Added a boolean flag which indicates the user had modified main chart's selection. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype.render): Set the main chart's selection to the entire range of points in the analysis task if the user had never modified selection. (AnalysisTaskPage.prototype._chartSelectionDidChange): This callback is invoked only when the user had modified the selection so set _selectionWasModifiedByUser true here unconditionally. 2016-03-19 Ryosuke Niwa Associated commits don't immediately show up on an analysis task page https://bugs.webkit.org/show_bug.cgi?id=155692 Reviewed by Darin Adler. The bug was caused by resolveCommits in AnalysisTask._constructAnalysisTasksFromRawData not being able to find the matching commit log if the commit log had been created by the charts which don't set the remote identifiers on each CommitLog objects. Fixed the bug by modifying /api/measurement-set to include the commit ID, and making CommitLog use the real database ID as its ID instead of a fake ID we create from repository and revision. Also added a bunch of Mocha unit tests for AnalysisTask.fetchAll. * public/api/measurement-set.php: (MeasurementSetFetcher::execute_query): Fetch commit_id. (MeasurementSetFetcher::format_run): Use pass-by-reference to avoid making a copy of the row. (MeasurementSetFetcher::parse_revisions_array): Include commit_id as the first item in the result. * public/v3/instrumentation.js: * public/v3/models/analysis-task.js: (AnalysisTask): Fixed a bug that _buildRequestCount and _finishedBuildRequestCount could be kept as strings and hasPendingRequests() could return a wrong result because it would perform string inequality instead of numerical inequality. (AnalysisTask.prototype.updateSingleton): Ditto. (AnalysisTask.prototype.dissociateCommit): (AnalysisTask._constructAnalysisTasksFromRawData): (AnalysisTask._constructAnalysisTasksFromRawData.resolveCommits): Use findById now that CommitLog objects all use the same id as the database id. * public/v3/models/commit-log.js: (CommitLog): (CommitLog.prototype.remoteId): Deleted since we no longer create a fake id for commit logs for measurement sets. (CommitLog.findByRemoteId): Deleted. (CommitLog.ensureSingleton): Deleted. (CommitLog.fetchBetweenRevisions): * public/v3/models/data-model.js: (DataModelObject.clearStaticMap): Added to aid unit testing. (DataModelObject.ensureNamedStaticMap): Fixed a typo. Each map is a dictionary, not an array. * public/v3/models/metric.js: * public/v3/models/platform.js: * public/v3/models/root-set.js: (RootSet): Updated per the interface change in CommitLog.ensureSingleton. (MeasurementRootSet): Updated per /api/measurement-set change. Use the first value as the id. * public/v3/models/test.js: * unit-tests/analysis-task-tests.js: Added. (sampleAnalysisTask): (measurementCluster): * unit-tests/checkconfig.js: Added some assertion message to help aid diagnosing the failure. * unit-tests/measurement-adaptor-tests.js: Updated the sample data per the API change in /api/measurement-set and also added assertions for commit log ids. * unit-tests/measurement-set-tests.js: (beforeEach): * unit-tests/resources: Added. * unit-tests/resources/mock-remote-api.js: Added. Extracted from measurement-set-tests.js to be used in analysis-task-tests.js. (assert.notReached.assert.notReached): (global.RemoteAPI.getJSON): (global.RemoteAPI.getJSONWithStatus): (beforeEach): * unit-tests/resources/v3-models.js: Added. Extracted from measurement-set-tests.js to be used in analysis-task-tests.js and added more imports as needed. (importFromV3): (beforeEach): 2016-03-18 Ryosuke Niwa Build fix after r198464. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype._buildRowsForPointsAndTestGroups): 2016-03-18 Ryosuke Niwa Build fix after r198234. * public/api/commits.php: (main): Typo: fetch_latest_reported -> fetch_last_reported. * public/include/commit-log-fetcher.php: (CommitLogFetcher::format_single_commit): commits should be an array. 2016-03-18 Ryosuke Niwa Perf Dashboard v3 confuses better and worse on A/B task page https://bugs.webkit.org/show_bug.cgi?id=155675 Reviewed by Joseph Pecoraro. The analysis results viewer on v3 UI sometimes treats regressions as progressions and vice versa when the first set (i.e. set A) of the revisions used in an A/B testing never appears in the original graph, and its latest commit time matches that of the second set, which appears in the original graph. Because the analysis results viewer compares results in the increasing row number, this results in B to be compared to A instead of A to be compared to B. Fixed the bug by preventing the wrong ordering to occur in _buildRowsForPointsAndTestGroups by always inserting a root set A before B when B appears and A doesn't appear in the original graph. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype._collectRootSetsInTestGroups): Remember the succeeding root set B when creating an entry for root set A. (AnalysisResultsViewer.prototype._buildRowsForPointsAndTestGroups): Fixed the bug. Also un-duplicated the code to create a new row. (AnalysisResultsViewer.RootSetInTestGroup): Now takes a succeeding root set. e.g. it's B for A and undefined for B in A/B testing. (AnalysisResultsViewer.RootSetInTestGroup.prototype.succeedingRootSet): Added. * public/v3/components/time-series-chart.js: (TimeSeriesChart.computeTimeGrid): Fixed the bug that we would end up showing 0 AM instead of dates when both dates and months change. 2016-03-18 Ryosuke Niwa Add unit tests for measurement-set.js and measurement-adapter.js https://bugs.webkit.org/show_bug.cgi?id=155673 Reviewed by Daniel Bates. Add tests which were supposed to be added in r198462. * unit-tests/measurement-adaptor-tests.js: Added. * unit-tests/measurement-set-tests.js: Added. (assert.notReached): Added. (global.RemoteAPI.getJSON): Added. (global.RemoteAPI.getJSONWithStatus): Added. A mock. 2016-03-18 Ryosuke Niwa Add unit tests for measurement-set.js and measurement-adapter.js https://bugs.webkit.org/show_bug.cgi?id=155673 Reviewed by Darin Adler. Added mocha unit tests for MeasurementSet and MeasurementAdapter classes along with the necessary refactoring to run these tests in node. getJSON and getJSONStatus are now under RemoteAPI so that unit tests can mock them. Removed the dependency on v2 UI's TimeSeries and Measurement class by adding a new implementation of TimeSeries in v3 and removing the dependency on Measurement in chart-pane-status-view.js with new helper methods on Build and CommitLog. Many js files now use 'use strict' (node doesn't support class syntax in non-strict mode) and module.exports to export symbols in node's require function. * public/v3/index.html: * public/v3/main.js: * public/v3/models/analysis-results.js: (AnalysisResults.fetch): * public/v3/models/analysis-task.js: (AnalysisTask.fetchAll): * public/v3/models/builder.js: (Build): (Build.prototype.builder): Added. Used by ChartPaneStatusView. (Build.prototype.buildNumber): Ditto. (Build.prototype.buildTime): Ditto. * public/v3/models/commit-log.js: (CommitLog.prototype.diff): Ditto. (CommitLog.fetchBetweenRevisions): * public/v3/models/data-model.js: (DataModelObject.cachedFetch): * public/v3/models/measurement-adaptor.js: (MeasurementAdaptor.prototype.applyToAnalysisResults): Renamed from adoptToAnalysisResults. (MeasurementAdaptor.prototype.applyTo): Renamed from adoptToSeries. Now shares a lot more code with applyToAnalysisResults. The code to set 'series' and 'seriesIndex' has been moved to TimeSeries.append. 'measurement' is no longer needed as this patch removes its only use in ChartPaneStatusView. * public/v3/models/measurement-cluster.js: (MeasurementCluster.prototype.addToSeries): Use TimeSeries.append instead of directly mutating series._series. * public/v3/models/measurement-set.js: (Array.prototype.includes): Added a polyfill for node. (MeasurementSet.prototype._fetchSecondaryClusters): Removed a bogus assertion. When fetchBetween is called with a mixture of clusters that have been fetched and not fetched, this assertion fails. (MeasurementSet.prototype._fetch): (TimeSeries.prototype.findById): Moved to time-series.js. (TimeSeries.prototype.dataBetweenPoints): Ditto. (TimeSeries.prototype.firstPoint): Ditto. (TimeSeries.prototype.fetchedTimeSeries): Moved the code to extend the last point to TimeSeries' extendToFuture. * public/v3/models/repository.js: * public/v3/models/root-set.js: (MeasurementRootSet): Ignore repositories that had not been defined (e.g. it could be added after manifest.json had been downloaded but before a given root set is created for an A/B testing). * public/v3/models/time-series.js: (TimeSeries): Added. (TimeSeries.prototype.append): Added. (TimeSeries.prototype.extendToFuture): Added. (TimeSeries.prototype.firstPoint): Moved from measurement-set.js. (TimeSeries.prototype.lastPoint): Added. (TimeSeries.prototype.previousPoint): Added. (TimeSeries.prototype.nextPoint): Added. (TimeSeries.prototype.findPointByIndex): Added. (TimeSeries.prototype.findById): Moved from measurement-set.js. (TimeSeries.prototype.findPointAfterTime): Added. (TimeSeries.prototype.dataBetweenPoints): Moved from measurement-set.js. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView.prototype.render): Use newly added helper functions on Build. (ChartPaneStatusView.prototype._formatTime): Added. (ChartPaneStatusView.prototype.setCurrentRepository): (ChartPaneStatusView.prototype.computeChartStatusLabels): Rewrote the code using RootSet object on currentPoint and previousPoint instead of Measurement class from v2 UI. Also sort the results using sortByNamePreferringOnesWithURL. * public/v3/remote.js: (RemoteAPI.getJSON): Moved under RemoteAPI. (RemoteAPI.getJSONWithStatus): Ditto. (PrivilegedAPI): (PrivilegedAPI.requestCSRFToken): 2016-03-17 Ryosuke Niwa Add unit tests for config.json and statistics.js https://bugs.webkit.org/show_bug.cgi?id=155626 Reviewed by Darin Adler. Added mocha unit tests for statistics.js and validating config.json. For segmentations, I've extracted real data from our internal perf dashboard. Also fixed some bugs covered by these new tests. * public/shared/statistics.js: (Statistics.movingAverage): Fixed a bug that forwardWindowSize was never used. (Statistics.exponentialMovingAverage): Fixed the bug that the moving average starts at 0. It should start at the first value instead. (.splitIntoSegmentsUntilGoodEnough): Fixed the bug that we may try to segment a time series into more parts than there are data points. Clearly, that doesn't make any sense. (.findOptimalSegmentation): Renamed local variables so that they're more descriptive, and rewrote the debugging code was the old code was emitting some useless data. Also fixed the bug that the length of "segmentation" was off by one (we need segmentCount + 1 elements in the array sine we always include the start of the first segment = 0 and the end of the last segment = values.length). (.SampleVarianceUpperTriangularMatrix): (Statistics): Modernized the export code. * tools/js: Added. * tools/js/config.js: Added. (Config): Added. (Config.prototype.configFilePath): Added. (Config.prototype.value): Added. (Config.prototype.path): Added. * tools/js/database.js: Added. (Database): Added. (Database.prototype.connect): Added. (Database.prototype.disconnect): Added. * unit-tests: Added. * unit-tests/checkconfig.js: Added. Validates config.json. This is useful while setting up a local instance of the perf dashboard. * unit-tests/statistics-tests.js: Added. (assert.almostEqual): Added. Asserts that two floating values are within a given significant digits. (.stdev): (.delta): (.computeWelchsT): 2016-03-17 Ryosuke Niwa Fix a typo which was supposed to be fixed in r198351. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype.render): 2016-03-17 Ryosuke Niwa An analysis task should be closed if a progression cause is identified https://bugs.webkit.org/show_bug.cgi?id=155549 Reviewed by Chris Dumez. Since a progression is desirable, we should close an analysis task once its cause is identified. Also fix some typos. * init-database.sql: Fixed a typo. * public/api/analysis-tasks.php: * public/v3/models/analysis-task.js: (AnalysisTask.prototype.dissociateBug): Renamed from dissociateBug. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype.render): (AnalysisTaskPage.prototype._dissociateBug): Renamed from _dissociateBug. (AnalysisTaskPage.prototype._dissociateCommit): Fixed the typo in the alert. 2016-03-16 Ryosuke Niwa Analysis task page should allow specifying commits that caused or fixed a regression or a progression https://bugs.webkit.org/show_bug.cgi?id=155529 Reviewed by Chris Dumez. Added the capability to associate revisions that caused or fixed a progression or a regression for which an analysis task was created. Added task_commits that stores this relationship and added the backend support to retrieve this table in /api/analysis-tasks and an privileged API to update this table at /privileged-api/associate-commit. Also extracted a new component, MutableListView, out of AnalysisTaskPage to render and manipulate a list of mutable items, and used it to render the list of associated bugs and commits. The view takes a list of kinds (e.g. repositories or bug trackers), and accepts a pair of a kind and arbitrary text as a new item value. * init-database.sql: Added task_commits table. * public/api/analysis-tasks.php: (main): (fetch_associated_data_for_tasks): Renamed from fetch_and_push_bugs_to_tasks now that it also fetches the list of commits associated with each analysis task by calling CommitLogFetcher::fetch_for_tasks. Also fixe the bug that we were not taking (format_task): No longer sets 'category' since the computation of category now depends on the list of commits associated with this analysis task which aren't available until fetch_associated_data_for_tasks. (determine_category): Added. Categorize any analysis tasks with "fixes" commits as "closed" and "causes" commits as "identified". * public/include/commit-log-fetcher.php: (CommitLogFetcher::__construct): Remove the unused instance variable. (CommitLogFetcher::fetch_for_tasks): Added. Fetches all commits associated with a list of analysis tasks. Assumes the caller (fetch_associated_data_for_tasks) had setup "fixes" and "causes" fields on each task. * public/privileged-api/associate-commit.php: Added. Updates task_commits table to associate or disassociate a commit with an analysis task. When the specified analysis task and the specified commit are already associated, we simply update the table instead of adding a duplicating entry or error. For dissociation, the front-end specifies the commit ID. (main): Added. * public/v3/index.html: * public/v3/components/mutable-list-view.js: Added. Used by the list associated bugs and commits. (MutableListView): Added. (MutableListView.prototype.setList): Added. (MutableListView.prototype.setKindList): Added. (MutableListView.prototype.setAddCallback): Added. This callback is invoked when the user tries to add a new item to the list. (MutableListView.prototype.render): Added. (MutableListView.prototype._submitted): Added. (MutableListView.cssTemplate): (MutableListView.htmlTemplate): (MutableListItem): Added. RemovalLink could be a hyperlink or a callback and gets involved when the user tries to delete this item. (MutableListItem.prototype.content): * public/v3/models/analysis-task.js: (AnalysisTask): Added the support of the list of commits that fixed and caused changes. (AnalysisTask.prototype.updateSingleton): Ditto. (AnalysisTask.prototype.causes): Added. (AnalysisTask.prototype.fixes): Added. (AnalysisTask.prototype.associateCommit): Added. Use the API added at /privileged-api/associate-commit to associate a new commit with this analysis task. Each commit has either caused or fixed the change. (AnalysisTask.prototype.dissociateCommit): Added. Use the same API to disassociate each commit. (AnalysisTask._constructAnalysisTasksFromRawData): Find all commits associated with each analysis task. Because commit log objects use a fake ID fdue to /api/measurement-set not providing commit IDs, we must use CommitLog.findByRemoteId to find each commit instead of usual CommitLog.findById. (AnalysisTask._constructAnalysisTasksFromRawData.resolveCommits): Added. * public/v3/models/build-request.js: (BuildRequest.prototype.hasFinished): Renamed from hasCompleted since it was confusing for this._status being "completed" wasn't a necessary condition for this function to return true. * public/v3/models/commit-log.js: (CommitLog): Added the static map for actual commit ID instead of a fake ID created in ensureSingleton. (CommitLog.prototype.remoteId): Added. Returns the real commit ID. (CommitLog.findByRemoteId): Added. Finds an CommitLog object using the real ID. * public/v3/models/test-group.js: (TestGroup.prototype.hasFinished): Renamed from hasCompleted to match the rename in BuildRequest. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): Added lists for the commits that fixed and caused the change using MutableListView. Also adopted MutableListView for the list of associated bugs. (AnalysisTaskPage.prototype.render): Added the code to populate the newly added lists. (AnalysisTaskPage.prototype._makeCommitListItem): Added. (AnalysisTaskPage.prototype._associateBug): Now this is a callback from MutableListView. (AnalysisTaskPage.prototype._associateCommit): Added. (AnalysisTaskPage.prototype._dissociateCommit): Added. (AnalysisTaskPage.htmlTemplate): (AnalysisTaskPage.cssTemplate): * public/v3/remote.js: (getJSON): Spit out the entire responseText when JSON failed to parse to make debugging easier. 2016-03-15 Ryosuke Niwa Extract the code to format commit logs into its own PHP file https://bugs.webkit.org/show_bug.cgi?id=155514 Rubber-stamped by Chris Dumez. Extracted CommitLogFetcher out of /api/commits so that it could be used in analysis-tasks.php in the future to support associating cause/fix for each analysis task. * public/api/commits.php: * public/include/commit-log-fetcher.php: Added. (CommitLogFetcher) (CommitLogFetcher::__construct): Added. (CommitLogFetcher::repository_id_from_name): Added. (CommitLogFetcher::fetch_between): Added. (CommitLogFetcher::fetch_oldest): Added. (CommitLogFetcher::fetch_latest): Added. (CommitLogFetcher::fetch_last_reported): Added. (CommitLogFetcher::fetch_revision): Added. (CommitLogFetcher::commit_for_revision): Added. (CommitLogFetcher::format_single_commit): Added. (CommitLogFetcher::format_commit): Added. 2016-03-09 Ryosuke Niwa Build fix after r196870. * public/include/report-processor.php: 2016-03-09 Ryosuke Niwa Add Size metric to perf dashboard https://bugs.webkit.org/show_bug.cgi?id=155266 Reviewed by Chris Dumez. Added the "Size" metric and use bytes as its unit. * public/js/helper-classes.js: (PerfTestRuns): * public/v2/data.js: (RunsData.unitFromMetricName): 2016-02-20 Ryosuke Niwa Add the support for universal slave password https://bugs.webkit.org/show_bug.cgi?id=154476 Reviewed by David Kilzer. Added the support for universalSlavePassword. * config.json: * public/include/report-processor.php: (ReportProcessor::process): (ReportProcessor::authenticate_and_construct_build_data): Extracted from process(). 2016-02-19 Ryosuke Niwa Analysis tasks page complains about missing repository but with a wrong name https://bugs.webkit.org/show_bug.cgi?id=154468 Reviewed by Chris Dumez. Fixed the bug by using the right variable in the template literal. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype._computeRootSetMap): Use querySelector here since Chrome doesn't have getElementsByClassName on ShadowRoot. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingRootSetList): Use name which is the name of repository here. 2016-02-18 Ryosuke Niwa Revert an unintended change made in the previous commit. * init-database.sql: 2016-02-18 Ryosuke Niwa Perf dashboard should let user cancel pending A/B testing and hide failed ones https://bugs.webkit.org/show_bug.cgi?id=154433 Reviewed by Chris Dumez. Added a button to hide a test group in the details view (the bottom table) in the analysis task page, and "Show hidden tests" link to show the hidden test groups on demand. When a test group is hidden, all pending requests in the group will also be canceled since a common scenario of using this feature is that the user had triggered an useless A/B testing; e.g. all builds will fail, wrong, etc... We can revisit and add the capability to just cancel the pending requests and leaving the group visible later if necessary. Run `ALTER TYPE build_request_status_type ADD VALUE 'canceled';` to add the new type. * init-database.sql: Added testgroup_hidden column to analysis_test_groups table and added 'canceled' as a value to build_request_status_type table. * public/api/test-groups.php: (format_test_group): Added 'hidden' field in the JSON result. * public/privileged-api/update-test-group.php: (main): Added the support for updating testgroup_hidden column. When this column is set to true, also cancel all pending build requests (by setting its request_status to 'canceled' which will be ignore by the syncing script). * public/v3/components/test-group-results-table.js: (TestGroupResultsTable.prototype.setTestGroup): Reset _renderedTestGroup here so that the next call to render() will update the table; e.g. when build requests' status change from 'Pending' to 'Canceled'. * public/v3/models/build-request.js: (BuildRequest.prototype.hasCompleted): A build request is considered complete/finished if it's canceled. (BuildRequest.prototype.hasPending): Added. (BuildRequest.prototype.statusLabel): Handle 'canceled' status. * public/v3/models/test-group.js: (TestGroup): (TestGroup.prototype.updateSingleton): Added to update 'hidden' field. (TestGroup.prototype.isHidden): Added. (TestGroup.prototype.hasPending): Added. (TestGroup.prototype.hasPending): Added. (TestGroup.prototype.updateHiddenFlag): Added. Uses the privileged API to update testgroup_hidden column. The JSON API also updates the status of the 'pending' build requests in the group to 'canceled'. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): Added _showHiddenTestGroups and _filteredTestGroups as instance variables. (AnalysisTaskPage.prototype._didFetchTestGroups): (AnalysisTaskPage.prototype._showAllTestGroups): Added. (AnalysisTaskPage.prototype._didUpdateTestGroupHiddenState): Extracted from _didFetchTestGroups. (AnalysisTaskPage.prototype._renderTestGroupList): Use the filtered list of test groups to show the list of test groups. When all test groups are shown, we would first show the hidden ones after the regular ones. (AnalysisTaskPage.prototype._createTestGroupListItem): Extracted from _renderTestGroupList. (AnalysisTaskPage.prototype._renderTestGroupDetails): Update the text inside the button to hide the test group. Also show a warning text that the pending requests will be canceled if there are any. (AnalysisTaskPage.prototype._hideCurrentTestGroup): Added. (AnalysisTaskPage.cssTemplate): Updated the style. 2016-02-18 Ryosuke Niwa The rows in the analysis results table should be expandable https://bugs.webkit.org/show_bug.cgi?id=154427 Reviewed by Chris Dumez. Added "(Expand)" link between rows that have hidden points. Upon click it inserts the hidden rows. We insert around five rows at a time when there are hundreds of hidden points but we also avoid leaving behind expandable rows of less than two rows. Also fixed a bug in CustomizableTestGroupForm that getElementsById would throw in the shipping Safari because getElementsById doesn't exist on Element.prototype by using class name instead. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer): (AnalysisResultsViewer.prototype.setCurrentTestGroup): Removed superfluous call to render(). (AnalysisResultsViewer.prototype.setPoints): Always show the start and the end points. (AnalysisResultsViewer.prototype.buildRowGroups): (AnalysisResultsViewer.prototype._buildRowsForPointsAndTestGroups): Add an instance of ExpandableRow which shows a "(Expand)" link to show hidden rows here. (AnalysisResultsViewer.prototype._expandBetween): Added. Expands rows between two points. (AnalysisResultsViewer.cssTemplate): Added rules for "(Expand)" links. (AnalysisResultsViewer.ExpandableRow): Added. (AnalysisResultsViewer.ExpandableRow.prototype.resultContent): Added. Overrides what's in the results column. (AnalysisResultsViewer.ExpandableRow.prototype.heading): Added. Generates "(Expand)" link. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.prototype._computeRootSetMap): Use getElementsByClassName instead of getElementById. (CustomizableTestGroupForm.prototype._classForLabelAndRepository): Renamed from _idForLabelAndRepository. (CustomizableTestGroupForm._constructRevisionRadioButtons): Set class name instead of id. * public/v3/components/results-table.js: (ResultsTable.prototype.render): Don't generate radio buttons to select a row when root set is missing; e.g. for rows that show "(Expand)" links. 2016-02-18 Ryosuke Niwa Statistically significant A/B testing results should be color coded in details view https://bugs.webkit.org/show_bug.cgi?id=154414 Reviewed by Chris Dumez. Color code the statistically significant comparisions in TestGroupResultsTable as done in the analysis results viewer. * public/v3/components/customizable-test-group-form.js: (CustomizableTestGroupForm.cssTemplate): Build fix after r196768. * public/v3/components/test-group-results-table.js: (TestGroupResultsTable.prototype.buildRowGroups): Add the status as a class name. (TestGroupResultsTable.cssTemplate): Added styles to color-code statistically significant results. 2016-02-17 Ryosuke Niwa v3 UI should allow custom revisions for A/B testing https://bugs.webkit.org/show_bug.cgi?id=154379 Reviewed by Chris Dumez. Added the capability to customize revisions selected in the overview chart and the results viewer. Newly added CustomizableTestGroupForm is responsible for allowing users to modify the set of revisions in a new A/B testing group. Unlike TestGroupForm which doesn't know anything about which revisions are selected for each project/repository, CustomizableTestGroupForm is aware of the list of revisions used in each set. The list of revisions used in each set is represented by RootSet if users had not customized them, and CustomRootSet otherwise; the latter was added since regular RootSet object requires CommitLog and other DataModelObjects which are hard to create without corresponding database entries. * public/v3/components/customizable-test-group-form.js: Added. (CustomizableTestGroupForm): Added. (CustomizableTestGroupForm.prototype.setRootSetMap): Added. (CustomizableTestGroupForm.prototype._submitted): Overrides the superclass' method. (CustomizableTestGroupForm.prototype._customize): Ditto. Unlike TestGroupForm's callback, this class' callback passes in a root set map as the third argument. (CustomizableTestGroupForm.prototype._computeRootSetMap): Added. Returns this._rootSetMap, which is set by AnalysisTaskPage if user had not customized the root sets. Otherwise return a new map with CustomRootSet's. (CustomizableTestGroupForm.prototype.render): Added. Creates a table to allow customization of root sets. (CustomizableTestGroupForm._constructRevisionRadioButtons): Added. (CustomizableTestGroupForm._createRadioButton): Added. (CustomizableTestGroupForm.cssTemplate): Added. (CustomizableTestGroupForm.formContent): Added. This method is called by TestGroupForm.htmlTemplate. * public/v3/components/test-group-form.js: (TestGroupForm): Updated the various methods to not directly mutate DOM. Store the state in instance variables and update DOM in render() as done elsewhere. (TestGroupForm.prototype.setNeedsName): Deleted. We no longer need this flag since TestGroupForm which is used for retries never needs a name and CustomizableTestGroupForm which is used to create a new test group always requires a name. (TestGroupForm.prototype.setDisabled): (TestGroupForm.prototype.setLabel): (TestGroupForm.prototype.setRepetitionCount): (TestGroupForm.prototype.render): Added. (TestGroupForm.prototype._submitted): Moved the code to prevent the default action has been moved to the constructor since this method is overridden by CustomizableTestGroupForm. (TestGroupForm.cssTemplate): Added. (TestGroupForm.htmlTemplate): (TestGroupForm.formContent): Extracted from htmlTemplate. * public/v3/index.html: * public/v3/models/repository.js: (Repository.sortByNamePreferringOnesWithURL): Added. * public/v3/models/root-set.js: (RootSet.prototype.revisionForRepository): Added so that _createTestGroupAfterVerifyingRootSetList can retrieve the revision information from CustomRootSet without going through CommitLog objects since CustomRootSet doesn't have associated CommitLog objects. (CustomRootSet): Added. Used by CustomizableTestGroupForm to create a custom root map since regular RootSet requires CommitLog and other related objects which are hard to create without database entries. (CustomRootSet.prototype.setRevisionForRepository): Added. (CustomRootSet.prototype.repositories): Added. (CustomRootSet.prototype.revisionForRepository): Added. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): (AnalysisTaskPage.prototype.render): Removed the reference to v2 UI since v3 UI is now strictly more powerful than v2 UI. Also update the root set maps in each form here. (AnalysisTaskPage.prototype._retryCurrentTestGroup): No longer takes unused name argument as it got removed from TestGroupForm. (AnalysisTaskPage.prototype._chartSelectionDidChange): No longer updates the disabled-ness here since it's now done in render() via setRootSetMap(). (AnalysisTaskPage.prototype._createNewTestGroupFromChart): Now takes rootSetMap as an argument. (AnalysisTaskPage.prototype._selectedRowInAnalysisResultsViewer): No longer updates the disabled-ness here since it's now done in render() via setRootSetMap(). (AnalysisTaskPage.prototype._createNewTestGroupFromViewer): Now takes rootSetMap as an argument. (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingRootSetList): Take a dictionary of root set labels such as A and B, which maps to a RootSet or a newly-added CustomRootSet. (AnalysisTaskPage.htmlTemplate): Use customizable-test-group-form for creating a new A/B testing group. Retry form will continue to use TestGroupForm since customizing revisions is non-sensical in retries. (AnalysisTaskPage.cssTemplate): Updated the style. 2016-02-16 Ryosuke Niwa v3 UI has the capability to schedule an A/B testing in a specific range https://bugs.webkit.org/show_bug.cgi?id=154329 Reviewed by Chris Dumez. Extended AnalysisTaskChartPane and ResultsTable so that users can select a range of points in either the overview chart pane and the results viewer table. Extracted TestGroupForm out of the analysis task page and used right below those two components in the analysis task page. * public/v3/components/results-table.js: (ResultsTable): (ResultsTable.prototype.setRangeSelectorLabels): Added. (ResultsTable.prototype.setRangeSelectorCallback): Added. (ResultsTable.prototype.selectedRange): Added. (ResultsTable.prototype._rangeSelectorClicked): Added. (ResultsTable.prototype.render): Generate radio boxes to select a range. * public/v3/components/test-group-form.js: (TestGroupForm): (TestGroupForm.prototype.setStartCallback): Added. (TestGroupForm.prototype.setNeedsName): Added. (TestGroupForm.prototype.setDisabled): Added. (TestGroupForm.prototype.setLabel): Added. (TestGroupForm.prototype.setRepetitionCount): Added. (TestGroupForm.prototype._submitted): Added. (TestGroupForm.htmlTemplate): Extracted from AnalysisTaskPage.htmlTemplate. * public/v3/index.html: * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane.prototype._mainSelectionDidChange): Added. Delegates the work to AnalysisTaskPage. (AnalysisTaskChartPane.prototype.selectedPoints): Added. (AnalysisTaskPage): (AnalysisTaskPage.prototype.title): (AnalysisTaskPage.prototype.render): (AnalysisTaskPage.prototype._renderTestGroupDetails): Use TestGroupForm's methods instead of mutating DOM. (AnalysisTaskPage.prototype._retryCurrentTestGroup): (AnalysisTaskPage.prototype._chartSelectionDidChange): Added. (AnalysisTaskPage.prototype._createNewTestGroupFromChart): Added. (AnalysisTaskPage.prototype._selectedRowInAnalysisResultsViewer): Added. (AnalysisTaskPage.prototype._createNewTestGroupFromViewer): Added. (AnalysisTaskPage.prototype._createRetryNameForTestGroup): (AnalysisTaskPage.prototype._createTestGroupAfterVerifyingRootSetList): Extracted from _retryCurrentTestGroup so that we can call it in _createNewTestGroupFromChart and _createNewTestGroupFromViewer. (AnalysisTaskPage.htmlTemplate): 2016-02-15 Ryosuke Niwa Extract the code specific to v2 UI out of shared statistics.js https://bugs.webkit.org/show_bug.cgi?id=154277 Reviewed by Chris Dumez. Extracted statistics-strategies.js out of statistics.js for v2 UI and detect-changes.js. The intent is to deprecate this file once we implement refined statistics tools in v3 UI and adopt it in detect-changes.js. * public/shared/statistics.js: (Statistics.movingAverage): Extracted from the "Simple Moving Average" strategy. (Statistics.cumultaiveMovingAverage): Extracted from the "Cumulative Moving Average" strategy. (Statistics.exponentialMovingAverage): Extracted from the "Exponential Moving Average" strategy. Use a temporary "movingAverage" to keep the last moving average instead of relying on the previous entry in "averages" array to avoid special casing an array of length 1 and starting the loop at i = 1. (Statistics.segmentTimeSeriesGreedyWithStudentsTTest): Extracted from "Segmentation: Recursive t-test" strategy. Don't create the list of averages to match segmentTimeSeriesByMaximizingSchwarzCriterion here. It's done in newly added averagesFromSegments. (Statistics.segmentTimeSeriesByMaximizingSchwarzCriterion): Extracted from "Segmentation: Schwarz criterion" strategy. (.recursivelySplitIntoTwoSegmentsAtMaxTIfSignificantlyDifferent): Just store the start index to match * public/v2/app.js: (App.Pane.updateStatisticsTools): (App.Pane._computeMovingAverageAndOutliers): * public/v2/data.js: * public/v2/index.html: * public/v2/statistics-strategies.js: Added. (StatisticsStrategies.MovingAverageStrategies): Added. (averagesFromSegments): Extracted from "Segmentation: Schwarz criterion" strategy. Now used by both "Segmentation: Recursive t-test" and "Segmentation: Schwarz criterion" strategies. (StatisticsStrategies.EnvelopingStrategies): Moved from Statistics.EnvelopingStrategies. (StatisticsStrategies.TestRangeSelectionStrategies): Moved from Statistics.TestRangeSelectionStrategies. (createWesternElectricRule): Moved from statistics.js. (countValuesOnSameSide): Ditto. (StatisticsStrategies.executeStrategy): Moved from Statistics.executeStrategy. * tools/detect-changes.js: (computeRangesForTesting): 2016-02-15 Ryosuke Niwa v1 UI and v2 UI should share statistics.js https://bugs.webkit.org/show_bug.cgi?id=154262 Reviewed by Chris Dumez. Share statistics.js between v1 and v2 UI. * public/index.html: * public/js/shared.js: Deleted. * public/js/statistics.js: Removed. * public/shared: Added. * public/shared/statistics.js: Moved from Websites/perf.webkit.org/public/v2/js/statistics.js. * public/v2/index.html: * public/v2/js/statistics.js: Removed. * public/v3/index.html: * tools/detect-changes.js: 2016-02-13 Ryosuke Niwa v3 UI sometimes shows same dates twice on the x-axis of time series charts https://bugs.webkit.org/show_bug.cgi?id=154210 Reviewed by Chris Dumez. The bug was caused by the label generation code in TimeSeriesChart.computeTimeGrid never emitting hours. Use hours instead of dates as labels when the current time's date is same as the previous label's date. Always include dates before entering this mode to avoid just having hours as labels on the entire x-axis. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype._renderXAxis): Slightly increase the "average" width of x-axis label. (TimeSeriesChart.computeTimeGrid): See above. Also assert that the number of labels we generate never exceeds maxLabels as a sanity check. (TimeSeriesChart._timeIterators): Added an iterator that increments by two hours for zoomed graphs. 2016-02-13 Ryosuke Niwa v3 UI should show status and associated bugs on analysis task pages https://bugs.webkit.org/show_bug.cgi?id=154212 Reviewed by Chris Dumez. Added the capability to see and modify the status and the list of associated of bugs on analysis task pages. Also added the list of related tasks, which are analysis tasks associated with the same bug or have overlapping time ranges with the same test metric but on a potentially different platform. In addition, categorize analysis tasks with the status of "no change" or "inconclusive" as "closed" as no further action can be taken (users can bring them back to non-closed state without any restrictions). * public/api/analysis-tasks.php: (format_task): Categorize 'unchanged' and 'inconclusive' analysis tasks as closed. * public/privileged-api/associate-bug.php: (main): Added shouldDelete as a new mechanism to disassociate a bug since v3 UI shares a single Bug object between multiple analysis tasks (as it should have been in the first place). * public/v3/components/chart-pane-base.js: (ChartPaneBase): (ChartPaneBase.prototype._fetchAnalysisTasks): Since each analysis task's change type (status/result) could change, we need to create annotation objects during each render() call. (ChartPaneBase.prototype.render): (ChartPaneBase.prototype._renderAnnotations): Extracted from ChartPaneBase.prototype._fetchAnalysisTasks to do that. I was afraid of the perf impact of this but it doesn't seem to be an issue in my testing. (ChartPaneBase.cssTemplate): Removed superfluous margins (moved to ChartPane.cssTemplate) around the charts since they are only useful in the charts page. * public/v3/models/analysis-task.js: (AnalysisTask): (AnalysisTask.prototype.updateSingleton): Added a comment as to why object.result cannot be renamed to object.changeType in the JSON API. (AnalysisTask.prototype.updateName): Added. (AnalysisTask.prototype.updateChangeType): Added. (AnalysisTask.prototype._updateRemoteState): Added. (AnalysisTask.prototype.associateBug): Added. (AnalysisTask.prototype.disassociateBug): Added. (AnalysisTask.fetchRelatedTasks): Added. See above for the criteria of related-ness. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): (AnalysisTaskPage.prototype.updateFromSerializedState): (AnalysisTaskPage.prototype._fetchRelatedInfoForTaskId): Extracted from updateFromSerializedState. (AnalysisTaskPage.prototype._didFetchRelatedAnalysisTasks): Added. (AnalysisTaskPage.prototype.render): Render the list of associated bugs, the list of bug trackers (so that users can use it to associate with a new bug), and the list of related analysis tasks. (AnalysisTaskPage.prototype._renderTestGroupList): Extracted from render since it was getting too long. (AnalysisTaskPage.prototype._renderTestGroupDetails): Ditto. (AnalysisTaskPage.prototype._updateChangeType): Added. (AnalysisTaskPage.prototype._associateBug): Added. (AnalysisTaskPage.prototype._disassociateBug): Added. (AnalysisTaskPage.htmlTemplate): Added various elements to show and modify the status, associate bugs, and a list of related analysis tasks. (AnalysisTaskPage.cssTemplate): Added various styles for those form controls. * public/v3/pages/chart-pane.js: (ChartPane.cssTemplate): Moved the margins from ChartPaneBase.cssTemplate. 2016-02-12 Ryosuke Niwa Perf dashboard should allow renaming analysis tasks and test groups https://bugs.webkit.org/show_bug.cgi?id=154200 Reviewed by Chris Dumez. Allow editing names of analysis tasks and A/B testing groups in the v3 UI. Added the support for updating the name to the privileged API at /privileged-api/update-analysis-task and added a new prevailed API to update A/B testing groups at /privileged-api/update-test-group. * public/privileged-api/update-analysis-task.php: Added the support for renaming the analysis task. (main): * public/privileged-api/update-test-group.php: Added. Supports updating the test group's name. (main): * public/v3/components/editable-text.js: Added. (EditableText): Added. A new editable text label control. It looks like a text node with "(Edit)" link at the end which allow users to go into the "editing mode", which reveals an input element. The user can exit the editing mode by either moving the focus away from the control or clicking on "(Save)" at the end. It calls _updateCallback in the latter case. (EditableText.prototype.editedText): Returns the current value of the input element user. (EditableText.prototype.setText): Sets the label. This does not live-update the input element until the user exists the current editing mode and re-enters it. (EditableText.prototype.setStartedEditingCallback): Sets a callback which gets called when the user requested to enter the editing mode. Since EditableText relies on AnalysisTaskPage to render, this callback only exits to call EditableText.render() in AnalysisTask._didStartEditingTaskName. (EditableText.prototype.setUpdateCallback): Sets a callback which gets called when the user exits the editing mode by activating the "(Save)" link. This callback MUST return a promise upon resolution of which the control gets out of the editing mode. While the promise is in flight, the input element becomes readonly. (EditableText.prototype.render): Updates various states of the elements. When _updatingPromise is not falsy, we make the input element readonly and show '(...)' on the link. Don't show the action link if the label is empty (e.g. analysis task or test group is still being fetched). (EditableText.prototype._didClick): Called when the user clicked on the action link. Enter the editing mode or save the edited label via _updateCallback. (EditableText.prototype._didBlur): Exit the editing mode without saving if the input element is not focused, there is no inflight promise returned by _updateCallback, and the action link "(Save)" does not have the focus. (EditableText.prototype._didUpdate): Called when exiting the editing mode. (EditableText.htmlTemplate): (EditableText.cssTemplate): * public/v3/index.html: Include newly added editable-text.js. * public/v3/models/analysis-task.js: (AnalysisTask.prototype.updateSingleton): Added. (AnalysisTask.prototype.updateName): Added. Uses PrivilegedAPI to update the name and re-fetches the analysis task from the sever. (AnalysisTask._constructAnalysisTasksFromRawData): Use ensureSingleton instead of manually calling findById since we need to update the name of the singleton object we found (via updateSingleton). * public/v3/models/bug.js: (Bug.ensureSingleton): Moved the code to compute the synthetic id from AnalysisTask's _constructAnalysisTasksFromRawData. (Bug.prototype.updateSingleton): Added. Just assert that nothing changes. * public/v3/models/build-request.js: (BuildRequest.prototype.updateSingleton): Added. Assert that the intrinsic values of a build request doesn't change and update status text, status url, and build id as they could change. * public/v3/models/commit-log.js: (CommitLog): Made the constructor argument conform to the convention of id, object pair so that we can use DataModelObject.ensureSingleton. (CommitLog.ensureSingleton): (CommitLog.prototype.updateSingleton): Extracted from CommitLog.ensureSingleton. * public/v3/models/data-model.js: (DataModelObject.ensureSingleton): Call newly added updateSingleton. (DataModelObject.prototype.updateSingleton): (LabeledObject): Removed the name map since it's never used (findByName is never called anywhere). (LabeledObject.prototype.updateSingleton): Added. Updates _name. (LabeledObject.findByName): Deleted. * public/v3/models/test-group.js: (TestGroup.prototype.updateName): Added. Uses PrivilegedAPI to update the name and re-fetches the test group from the sever. (TestGroup._createModelsFromFetchedTestGroups): Removed bogus code. A root set doesn't have a test group associated with it since multiple test groups can share a single root set (this property doesn't even exist). * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): Removed useless _taskId and added this._testGroupLabelMap and this._taskNameLabel. (AnalysisTaskPage.prototype.updateFromSerializedState): Cleanup. (AnalysisTaskPage.prototype._didFetchTask): Assert that this function is called exactly once. (AnalysisTaskPage.prototype.render): Use this._task.id() to show the v2 link. Use EditableText to show the names of the analysis task and the associated test groups. Hide the overview chart and the list of test groups (along with the retry/confirm button) when the analysis task failed to fetch. We always update the names of the analysis task and the associated test groups since they could be updated by the server. (AnalysisTaskPage.prototype._didStartEditingTaskName): Added. (AnalysisTaskPage.prototype._updateTaskName): Added. (AnalysisTaskPage.prototype._updateTestGroupName): Added. (AnalysisTaskPage.htmlTemplate): Updated the style. 2016-02-11 Ryosuke Niwa Land the change that was supposed to be the part of r196463. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype._didFetchTestGroups): Select the latest test group by default. 2016-02-11 Ryosuke Niwa Refine v3 UI's analysis task page https://bugs.webkit.org/show_bug.cgi?id=154152 Reviewed by Chris Dumez. This patch makes the following refinements to the analysis task page: - Always show the relative different of in-progress A/B testing. - Make the annotations (colored bars) in the chart open other analysis tasks. - Order the A/B testing groups in the reverse chronological order. - Select the time range corresponding to the current test group. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.cssTemplate): Fixed the bug that pending and running testing groups are no longer colored after r196440. Use a slightly more opaque color for currently running groups compared to pending ones. * public/v3/components/chart-pane-base.js: (ChartPaneBase.prototype.setMainSelection): Added. (ChartPaneBase.prototype._openAnalysisTask): Moved the code from ChartPane._openAnalysisTask so that it can be reused in both AnalysisTaskChartPane and ChartPane (in charts page). (ChartPaneBase.prototype.router): Added. Overridden by each subclass. * public/v3/components/test-group-results-table.js: (TestGroupResultsTable.prototype.buildRowGroups): Always show the summary (relative difference of A to B) as long as there are some results in each set. * public/v3/models/test-group.js: (TestGroup.prototype.compareTestResults): Always set .label and .fullLabel with the relative change as long as there are some values. Keep using "pending" and "running" in .status since that would determine the color of stacking blocks representing those A/B testing groups. * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane): (AnalysisTaskChartPane.prototype.setPage): Added. (AnalysisTaskChartPane.prototype.router): Added. (AnalysisTaskPage): (AnalysisTaskPage.prototype.render): Show the list of A/B testing groups in the reverse chronological order. Also set the main chart's selection to the time range of the current test group. * public/v3/pages/chart-pane.js: (ChartPane.prototype.router): Added. (ChartPane.prototype._openAnalysisTask): Moved to ChartPaneBase.prototype._openAnalysisTask. 2016-02-11 Ryosuke Niwa Add a script to process backlogs created while perf dashboard was in the maintenance mode https://bugs.webkit.org/show_bug.cgi?id=154140 Reviewed by Chris Dumez. Added a script to process the backlog JSONs created while the perf dashboard was put in the maintenance mode. It re-submits each JSON file to the perf dashboard using the same server config file used by syncing scripts. * public/include/report-processor.php: (TestRunsGenerator::test_value_list_to_values_by_iterations): Fixed a bug in the error message code. It was referencing an undeclared variable. * tools/process-maintenance-backlog.py: Added. 2016-02-11 Ryosuke Niwa AnalysisResultsViewer never uses this._smallerIsBetter https://bugs.webkit.org/show_bug.cgi?id=154134 Reviewed by Chris Dumez. Removed the unused instance variable _smallerIsBetter from AnalysisResultsViewer and TestGroupStackingBlock. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer): Removed the unused _smallerIsBetter. (AnalysisResultsViewer.prototype.setSmallerIsBetter): Deleted. (AnalysisResultsViewer.prototype.buildRowGroups): (AnalysisResultsViewer.TestGroupStackingBlock): Removed the unused _smallerIsBetter. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.prototype._didFetchTask): 2016-02-11 Ryosuke Niwa Build fix after r196440. * public/v3/models/test-group.js: (TestGroup.prototype.addBuildRequest): Clear the map instead of setting the property to null. 2016-02-10 Ryosuke Niwa Perf dashboard should have UI to retry A/B testing https://bugs.webkit.org/show_bug.cgi?id=154090 Reviewed by Chris Dumez. Added a button to re-try an existing A/B testing group with a custom repetition count. The same button functions as a way of confirming the progression/regression when there have been no A/B testing scheduled in the task. Also fixed the bug that A/B testing groups that have been waiting for other test groups will be shown as "running". * public/v3/components/results-table.js: (ResultsTable.cssTemplate): Don't pad the list of extra repositories when it's empty. * public/v3/components/test-group-results-table.js: (TestGroupResultsTable.prototype.buildRowGroups): Use TestGroup.labelForRootSet instead of manually computing the letter for each configuration set. * public/v3/models/build-request.js: (BuildRequest.prototype.hasStarted): Added. * public/v3/models/data-model.js: (DataModelObject.ensureSingleton): Added. (DataModelObject.cachedFetch): Added noCache option. This is used when re-fetching the test groups after creating one. * public/v3/models/measurement-cluster.js: (MeasurementCluster.prototype.startTime): Added. * public/v3/models/measurement-set.js: (MeasurementSet.prototype.hasFetchedRange): Added. Returns true only if there are no "holes" (cluster yet to be fetched) between the specified time range. This was added to fix a bug in AnalysisTaskPage's _didFetchMeasurement. * public/v3/models/test-group.js: (TestGroup): Added this._rootSetToLabel. (TestGroup.prototype.addBuildRequest): Reset this._rootSetToLabel along with this._requestedRootSets. (TestGroup.prototype.repetitionCount): Added. Returns the number of iterations executed per set. We assume that every root set in the test group shares a single repetition count. (TestGroup.prototype.requestedRootSets): Now populates this._rootSetToLabel for labelForRootSet. (TestGroup.prototype.labelForRootSet): Added. (TestGroup.prototype.hasStarted): Added. (TestGroup.prototype.compareTestResults): Use 'running' and 'pending' to differentiate test groups that are waiting for other groups to finish running from the ones that are actually running ('incomplete' before this patch). (TestGroup.fetchByTask): (TestGroup.createAndRefetchTestGroups): Added. Creates a new test group using the privileged-api/create-test-group and fetches the list of test groups for the specified analysis task. (TestGroup._createModelsFromFetchedTestGroups): Extracted from TestGroup.fetchByTask. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): Initialize _renderedCurrentTestGroup to undefined so that we'd always can differentiate the initial call to AnalysisTaskPage.render and subsequent calls in which it's identical to _currentTestGroup. (AnalysisTaskPage.prototype._didFetchMeasurement): Fixed a bug that we don't exit early even when some clusters in between startPoint and endPoint are still being fetched via newly added hasFetchedRange. (AnalysisTaskPage.prototype.render): Update the default repetition count based on the current test group. Also update the label of the button to "Confirm the change" if there is no A/B testing in this task. (AnalysisTaskPage.prototype._retryCurrentTestGroup): Added. Re-triggers an existing A/B testing group or creates the A/B testing for the entire range of the analysis task. (AnalysisTaskPage.prototype._hasDuplicateTestGroupName): Added. (AnalysisTaskPage.prototype._createRetryNameForTestGroup): Added. (AnalysisTaskPage.htmlTemplate): Added form controls to re-trigger A/B testing. (AnalysisTaskPage.cssTemplate): Updated the style. 2016-02-10 Ryosuke Niwa Removed the duplicated definition of ChartPaneBase. * public/v3/components/chart-pane-base.js: 2016-02-09 Ryosuke Niwa Analysis task page on v3 UI should show charts https://bugs.webkit.org/show_bug.cgi?id=154057 Reviewed by Chris Dumez. Extracted ChartPaneBase out of ChartPane and added an instance of its new subclass, AnalysisTaskChartPane, to the analysis task page. The main difference is that ChartPaneBase doesn't depend on the presence of this._chartsPage unlike ChartPane. It also doesn't have the header with toolbar (to show breakdown, etc...). * public/v3/components/base.js: (ComponentBase.prototype._constructShadowTree): Call htmlTemplate() and cssTemplate() with the right "this". * public/v3/components/chart-pane-base.js: Added. (ChartPaneBase): Extracted from ChartPane. (ChartPaneBase.prototype.configure): Extracted from the constructor. Separating this function allows the component to be instantiated inside a HTML template. (ChartPaneBase.prototype._fetchAnalysisTasks): Moved from ChartPane._fetchAnalysisTasks. (ChartPaneBase.prototype.platformId): Ditto. (ChartPaneBase.prototype.metricId): Ditto. (ChartPaneBase.prototype.setOverviewDomain): Ditto. (ChartPaneBase.prototype.setMainDomain): Ditto. (ChartPaneBase.prototype._overviewSelectionDidChange): Extracted from the constructor. This is overridden in ChartPane and unused in AnalysisTaskChartPane. (ChartPaneBase.prototype._mainSelectionDidChange): Extracted from ChartPane._mainSelectionDidChange. (ChartPaneBase.prototype._mainSelectionDidZoom): Extracted from ChartPane._mainSelectionDidZoom. (ChartPaneBase.prototype._indicatorDidChange): Extracted from ChartPane._indicatorDidChange. (ChartPaneBase.prototype._didFetchData): Moved from ChartPane._fetchAnalysisTasks. (ChartPaneBase.prototype._openAnalysisTask): Ditto. (ChartPaneBase.prototype._openCommitViewer): Ditto. Also fixed a bug that we don't show the spinner while waiting for the data to be fetched by calling this.render() here. (ChartPaneBase.prototype._keyup): Moved from ChartPane._keyup. Also fixed the bug that the revisions list doesn't update by calling this.render() here. (ChartPaneBase.prototype.render): Extracted from ChartPane.render. (ChartPaneBase.htmlTemplate): Extracted from ChartPane.htmlTemplate. (ChartPaneBase.paneHeaderTemplate): Added. This is overridden in ChartPane and unused in AnalysisTaskChartPane. (ChartPaneBase.cssTemplate): Extracted from ChartPane.htmlTemplate. * public/v3/components/chart-styles.js: Renamed from public/v3/pages/page-with-charts.js. (PageWithCharts): Renamed from PageWithCharts since it no longer extends PageWithHeading. (ChartStyles.createChartSourceList): * public/v3/components/commit-log-viewer.js: (CommitLogViewer.prototype.view): Set this._repository right away instead of waiting for the fetched data so that spinner will be shown while the data is being fetched. * public/v3/index.html: * public/v3/pages/analysis-task-page.js: (AnalysisTaskChartPane): Added extends ChartPaneBase. (AnalysisTaskPage): Added. this._chartPane. (AnalysisTaskPage.prototype._didFetchTask): Initialize this._chartPane with a domain. (AnalysisTaskPage.prototype.render): Render this._chartPane. (AnalysisTaskPage.htmlTemplate): * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView): Removed the unused router from the argument list. (ChartPaneStatusView.prototype.pointsRangeForAnalysis): Renamed from analyzeData() since it was ambiguous. (ChartPaneStatusView.prototype.moveRepositoryWithNotification): Fixed the bug that we don't update the list of the revisions here. (ChartPaneStatusView.prototype.computeChartStatusLabels): * public/v3/pages/chart-pane.js: (ChartPane): Now extends ChartPaneBase. (ChartPane.prototype._overviewSelectionDidChange): Extracted from the constructor. (ChartPane.prototype._mainSelectionDidChange): (ChartPane.prototype._mainSelectionDidZoom): (ChartPane.prototype._indicatorDidChange): (ChartPane.prototype.render): (ChartPane.prototype._renderActionToolbar): (ChartPane.paneHeaderTemplate): Extracted from htmlTemplate. (ChartPane.cssTemplate): (ChartPane.overviewOptions.selection.onchange): Deleted. (ChartPane.prototype._fetchAnalysisTasks): Deleted. (ChartPane.prototype.platformId): Deleted. (ChartPane.prototype.metricId): Deleted. (ChartPane.prototype.setOverviewDomain): Deleted. (ChartPane.prototype.setMainDomain): Deleted. (ChartPane.prototype._openCommitViewer): Deleted. (ChartPane.prototype._didFetchData): Deleted. (ChartPane.prototype._keyup): Deleted. * public/v3/pages/charts-page.js: (ChartsPage): (ChartsPage.createDomainForAnalysisTask): Extracted by createDomainForAnalysisTask; used to set the domain of the charts in the analysis task page. (ChartsPage.createStateForAnalysisTask): * public/v3/pages/dashboard-page.js: (DashboardPage): (DashboardPage.prototype._createChartForCell): 2016-02-10 Ryosuke Niwa Add the support for maintenance mode https://bugs.webkit.org/show_bug.cgi?id=154072 Reviewed by Chris Dumez. Added the crude support for maintenance mode whereby which the reports are stored in the filesystem instead of the database. * config.json: Added maintenanceMode and maintenanceDirectory as well as forgotten siteTitle and remoteServer.httpdMutexDir. * public/api/report.php: (main): Don't connect to the database or modify database when maintenanceMode is set. * public/include/json-header.php: (ensure_privileged_api_data): Exit with InMaintenanceMode when maintenanceMode is set. This prevents privileged API such as creating analysis tasks and new A/B testing groups from modifying the database. 2016-02-09 Ryosuke Niwa Analysis task page on v3 show progression as regressions https://bugs.webkit.org/show_bug.cgi?id=154045 Reviewed by Chris Dumez. The bug was caused by TestGroup.compareTestResults referring to undefined _smallerIsBetter. Retrieve it from the associated metric object via the owner analysis task. * public/v3/models/test-group.js: 2016-02-05 Ryosuke Niwa Testing with remote server cache is unusably slow https://bugs.webkit.org/show_bug.cgi?id=153928 Reviewed by Chris Dumez. Don't use the single process mode of httpd as it's way too slow even for testing. Also we'll hit a null pointer crash (http://svn.apache.org/viewvc?view=revision&revision=1711479) Since httpd exits immediately when launched in multi-process mode, remote-cache-server.py (renamed from run-with-remote-server.py) now has "start" and "stop" commands to start/stop the Apache. Also added "reset" command to reset the cache for convenience. * Install.md: Updated the instruction. * config.json: Fixed a typo: httpdErro*r*Log. * tools/remote-cache-server.py: Copied from Websites/perf.webkit.org/tools/run-with-remote-server.py. Now takes one of the following commands: "start", "stop", and "reset". (main): (start_httpd): Extracted from main. (stop_httpd): Added. * tools/remote-server-relay.conf: Removed redundant (duplicate) LoadModule's. * tools/run-with-remote-server.py: Removed. 2016-02-04 Ryosuke Niwa Perf dashboard should have a script to setup database https://bugs.webkit.org/show_bug.cgi?id=153906 Reviewed by Chris Dumez. Added tools/setup-database.py to setup the database. It retrieves the database name, username, password and initializes a database at the specified location. * Install.md: Updated instruction to setup postgres to use setup-database.py. * tools/setup-database.py: Added. (main): (load_database_config): (determine_psql_dir): (start_or_stop_database): (execute_psql_command): 2016-01-12 Ryosuke Niwa buildbot syncing scripts sometimes schedule more than one requests per builder https://bugs.webkit.org/show_bug.cgi?id=153047 Reviewed by Chris Dumez. The bug was caused by the check for singularity of scheduledRequests being conducted per configuration instead of per builder. So if there were multiple test configurations (e.g. Speedometer and Octane) that both used the same builder, then we may end up scheduling both at once. Fixed the bug by sharing a single set to keep track of the scheduled requests for all configurations per builder. * tools/sync-with-buildbot.py: (load_config): Share a set amongst test configurations for each builder. (find_request_updates): Instead of creating a new set for each configuration, reuse the existing sets to share a single set agmonst test configurations for each builder. 2016-01-12 Ryosuke Niwa Analysis results viewer sometimes doesn't show the correct relative difference https://bugs.webkit.org/show_bug.cgi?id=152930 Reviewed by Chris Dumez. The bug was caused by single A/B testing result associated with multiple rows when there are multiple data points with the same root set which matches that of an A/B testing. Fixed the bug by detecting such a case, and only associating each A/B testing result with the row created for the first matching point. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.prototype._buildRowsForPointsAndTestGroups): 2016-01-08 Ryosuke Niwa Make v3 UI analysis task page is hard to understand https://bugs.webkit.org/show_bug.cgi?id=152917 Reviewed by Antti Koivisto. Add a dark gray border around the selected block in the analysis results viewer instead of using darker shades since that looks as if they were bigger regression/progression. Explicitly show "Failed" as the label instead of omitting with "-" when all build requests in an A/B testing group fails. * public/v3/components/analysis-results-viewer.js: (AnalysisResultsViewer.cssTemplate): Tweaked the style to underline text in the hovered blocks and the selected blocks and show a dark gray border around the selected blocks. (AnalysisResultsViewer.TestGroupStackingBlock): (AnalysisResultsViewer.TestGroupStackingBlock.prototype.createStackingCell): Use this._title for title. (AnalysisResultsViewer.TestGroupStackingBlock.prototype._computeTestGroupStatus): (AnalysisResultsViewer.TestGroupStackingBlock.prototype._valuesForRootSet): Deleted. * public/v3/components/results-table.js: (ResultsTable.prototype.render): (ResultsTable.prototype._createRevisionListCells): Extracted from ResultsTable.prototype.render. (ResultsTable.cssTemplate): Tweaked the style. (ResultsTableRow): (ResultsTableRow.prototype.constructor): Added _labelForWholeRow to store the label for the entire row. This is used to show the comparison result of two root sets (e.g. A vs B). (ResultsTableRow.prototype.setLabelForWholeRow): Added. (ResultsTableRow.prototype.labelForWholeRow): Added. (ResultsTableRow.prototype.resultContent): Extracted from buildHeading. Creates a hyperlinked bar graph used for each A/B testing result. (ResultsTableRow.prototype.buildHeading): Deleted since we need to set colspan on the second table cell when we're creating a row with _labelForWholeRow. * public/v3/components/test-group-results-table.js: (TestGroupResultsTable.prototype.buildRowGroups): Added rows to show relative differences and statistical significance between root sets (e.g. A vs B). * public/v3/models/build-request.js: (BuildRequest.prototype.hasCompleted): Added. * public/v3/models/test-group.js: (TestGroup.prototype.compareTestResults): Extracted from AnalysisResultsViewer.TestGroupStackingBlock's _computeTestGroupStatus and generalized to be reused in TestGroupResultsTable. (TestGroup.prototype._valuesForRootSet): Moved from AnalysisResultsViewer.TestGroupStackingBlock. * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage.cssTemplate): Tweaked the style. 2016-01-07 Ryosuke Niwa Perf dashboard should automatically add aggregators https://bugs.webkit.org/show_bug.cgi?id=152818 Reviewed by Chris Dumez. When an aggregator entry is missing in aggregators table, automatically insert it in /api/report. In a very early version of the perf dashboard, we had the ability to define a custom aggregator in an admin page. In practice, nobody used or needed this feature so we got rid of it even before the dashboard was landed into WebKit repository. This patch cleans up that mess. * run-tests.js: (main): Added the filtering capability. (TestEnvironment): Expose the config JSON in the test environment. * public/include/report-processor.php: (ReportProcessor): Renamed name_to_aggregator now that it only contains ID. (ReportProcessor::__construct): No longer fetches the aggregator table. An equivalent work is done in newly added ensure_aggregators. (ReportProcessor::process): Calls ensure_aggregators which populates name_to_aggregator_id. (ReportProcessor::ensure_aggregators): Added. Add the builtin aggregators: Arithmetic, Geometric, Harmonic, and Total. (TestRunsGenerator): Renamed name_to_aggregator now that it only contains ID. (TestRunsGenerator::__construct): (TestRunsGenerator::add_aggregated_metric): Don't include aggregator_definition here since it's never used now that all the aggregations are done natively in PHP. (TestRunsGenerator::$aggregators): Added. We don't include SquareSum since it's only used for computing run_square_sum_cache in test_runs table and it's useless elsewhere. (TestRunsGenerator::aggregate_values): Add a comment about that. * tests/api-report.js: Updated a test case to reflect the change. 2016-01-06 Ryosuke Niwa Perf dashboard JSON API should fail gracefully when postgres is down https://bugs.webkit.org/show_bug.cgi?id=152812 Reviewed by Chris Dumez. Even though all JSON APIs returned DatabaseConnectionFailure as the status when Database::connect returned a falsy value, PHP was spitting out warnings and producing HTTP responses that cannot be parsed as a JSON when pg_connect failed. Fixed the bug by suppressing warning messages in pg_connect. * public/include/db.php: (Database::connect): Use '@' prefix to suppress warning messages. 2016-01-06 Ryosuke Niwa Perf dashboard should auto-generate manifest file when one is missing https://bugs.webkit.org/show_bug.cgi?id=152813 Reviewed by Chris Dumez. When /data/manifest.json is missing, fall back to newly added /api/manifest instead of silently failing to show the UI. This will make the initial setup easier. * public/api/manifest.php: Added. (main): * public/include/manifest.php: (Manifest::manifest): Added. * public/v3/main.js: (fetchManifest): (didFetchManifest): Extracted from fetchManifest. 2016-01-06 Ryosuke Niwa Commit another forgotten change, this time, for r194653. * public/v3/models/measurement-set.js: 2016-01-06 Ryosuke Niwa The sampling of time series on v3 UI is too aggressive https://bugs.webkit.org/show_bug.cgi?id=152804 Reviewed by Chris Dumez. Fixed a bug that we were always halving the number of data points in _sampleTimeSeries and increased the number of data points allowed to make the sampling less aggressive. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype._ensureSampledTimeSeries): Increase the number of maximum points to 2x the number of pixels divided by the radius of each point. (TimeSeriesChart.prototype._sampleTimeSeries.findMedian): Changed the semantics of endIndex to mean the index after the last point and renamed it to indexAfterEnd. (TimeSeriesChart.prototype._sampleTimeSeries): Fixed a bug that this code always coerced two data points into one sampled data point despite of the fact i and j are sufficiently apart since data[j].time - data[i].time > timePerSample by definition. 2016-01-06 Ryosuke Niwa Commit the forgotten change for r194651. * public/v3/pages/domain-control-toolbar.js: (DomainControlToolbar.prototype.setStartTime): 2016-01-05 Ryosuke Niwa The right hand side of main chart appears to be cut off as you zoom out on v3 UI https://bugs.webkit.org/show_bug.cgi?id=152778 Reviewed by Antti Koivisto. Add a padding on x-axis after the end time to make the main chart more easily interactive. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype._computeHorizontalRenderingMetrics): * public/v3/pages/page-with-charts.js: (PageWithCharts.mainChartOptions): Add a padding of 5px at the end of x-axis. 2016-01-06 Ryosuke Niwa v3 UI should use four sig-figs to label y-axis of the main charts https://bugs.webkit.org/show_bug.cgi?id=152779 Reviewed by Antti Koivisto. Increase the number of significant figures used in the main charts to four as done in v2 UI. * public/v3/pages/chart-pane.js: (ChartPane.constructor): Create a formatter with four significant figures. * public/v3/pages/page-with-charts.js: (PageWithCharts.mainChartOptions): Increase the width of y-axis labels. 2016-01-05 Ryosuke Niwa v3 UI's time range slider is harder to use than that of v2 UI https://bugs.webkit.org/show_bug.cgi?id=152780 Reviewed by Antti Koivisto. Improved the time range slider by using a cubic mapping to time range and providing a text field to directly edit the number of days to show. Now an user can enter the text mode to directly edit the number of days to show by clicking on the number of days (text field is always there with opacity=0). * public/v3/pages/charts-toolbar.js: (ChartsToolbar): Store the minimum and maximum number of days allowed. Also rename _inputElement to _slider and added a new type=number text field as _editor. (ChartsToolbar.prototype.render): (ChartsToolbar.prototype.setStartTime): Exit the text mode when the number of days is changed by an URL state transition (i.e. back/forward navigation). (ChartsToolbar.prototype._setInputElementValue): Added. Updates the values of _slider and _editor. (ChartsToolbar.prototype._enterTextMode): Added. Hide the elements used by the slider mode and show the text field. (ChartsToolbar.prototype._exitTextMode): Added. Does the opposite. (ChartsToolbar.prototype._sliderValueMayHaveChanged): Renamed from _inputValueMayHaveChanged. (ChartsToolbar.prototype._editorValueMayHaveChanged): Added. Similar to _sliderValueMayHaveChanged but also corrects the value of _editor if needed. (ChartsToolbar.prototype._callNumberOfDaysCallback): Extracted from _inputValueMayHaveChanged. Also fixed a bug that we didn't update the URL state when the change event was fired without modifying the effective number of days. (ChartsToolbar.cssTemplate): Tweaked the style to support the new mode. Also set a fixed width on the span showing the number of days in the slider mode. 2016-01-06 Ryosuke Niwa Zooming button is broken on v3 UI https://bugs.webkit.org/show_bug.cgi?id=152777 Reviewed by Chris Dumez. Bring up the zoom button in z-index so that users can click it. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.cssTemplate): 2016-01-06 Ryosuke Niwa v3 UI doesn't preserve the time range when charts page is opened from a dashboard https://bugs.webkit.org/show_bug.cgi?id=152776 Reviewed by Chris Dumez. Fixed the bug by moving the construction of charts URL from DashboardPage.prototype.open to DashboardPage.prototype.render and re-rendering the entire page upon an URL state transition. * public/v3/pages/charts-page.js: (ChartsPage.createStateForDashboardItem): Takes the start time for the charts page. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype.updateFromSerializedState): Merged _numberOfDaysDidChange and _updateChartsDomainFromToolbar into this function since they're not used elsewhere. Also re-render the entire page when transition between different number of days to show. (DashboardPage.prototype._numberOfDaysDidChange): Deleted. (DashboardPage.prototype._updateChartsDomainFromToolbar): Deleted. (DashboardPage.prototype.render): Construct URL for each charts here. (DashboardPage.prototype._createChartForCell): Don't construct URL here since this function is called once when the dashboard page is opened, and not when the time range is changed. 2016-01-05 Ryosuke Niwa Build fix for an old version of PHP after r194618. * public/api/measurement-set.php: 2016-01-05 Ryosuke Niwa A/B testing results should be visualized intuitively on v3 UI https://bugs.webkit.org/show_bug.cgi?id=152496 Rubber-stamped by Chris Dumez. Add the "stacking block" view of A/B testing results to the analysis task page on v3 UI. The patch enhances JSON APIs at /api/analysis-task /api/measurement-set/ to reduce the number of HTTP requests, and adds two UI components: TestGroupResultsTable and AnalysisResultsViewer both of which inherits from an abstract superclass: ResultsTable. ResultsTable provides a tabular presentation of measured values in regular measurement sets and A/B testing results using groups of bar graphs created by BarGraphGroup. TestGroupResultsTable inherits from this class to display A/B testing configurations and the averaged results for each configuration, and AnalysisResultsViewer inherits from it to provide an intuitive visualization of the outcomes of all A/B testing results associated with a given analysis task. * public/api/analysis-tasks.php: (main): Add the capability to find the analysis task based on its build request. This allows /v3/#/analysis/task/?buildRequest= to be hyperlinked on buildbot page. * public/api/measurement-set.php: (main): Removed the unused startTime and endTime, and added "analysisTask" to query parameters. (AnalysisResultsFetcher): Added. Used to fetch measured data associated with every build request on an analysis task. (AnalysisResultsFetcher::__construct): (AnalysisResultsFetcher::fetch): Unlike MeasurementSetFetcher, we fetch the list of commits and list of measurements separately since there will be a lot less builds and commits than measured data (since we're fetching measured values for all tests and their metrics). (AnalysisResultsFetcher::fetch_commits): Fetches commits. (AnalysisResultsFetcher::format_measurement): Like MeasurementSetFetcher::format_measurement but with config_type and config_metric since we're returning measured data for all metrics and test configurations. (AnalysisResultsFetcher::format_map): Similar to MeasurementSetFetcher::format_map. * public/v3/components/analysis-results-viewer.js: Added. (AnalysisResultsViewer): Added. (AnalysisResultsViewer.prototype.didUpdateResults): This callback is called by AnalysisTaskPage when A/B testing results become available. (AnalysisResultsViewer.prototype.render): Overrides ResultsTable's render to highlight the block representing the currently selected test group. (AnalysisResultsViewer.prototype.buildRowGroups): Creates a list of rows with "stacking blocks" that visualizes A/B testing results. The algorithm works as follows: 1. Create all table rows. 2. Find which row is associated with each set in each test group. 3. Layout "blocks". (AnalysisResultsViewer.prototype._collectRootSetsInTestGroups): Collects root sets from all data in the measurement set as well as A/B testing **requests** (results may contain more repositories than requested but they aren't interesting for the purpose of visualizing results for the entire analysis task). (AnalysisResultsViewer.prototype._buildRowsForPointsAndTestGroups): Create table rows. First, create table rows for measurement set points that have a matching test group (i.e. either set A or set B of an A/B testing uses the same root set as a point). Second, insert a new row for each root set in each test group which didn't find a matching measurement set point. There is a little subtlety that some A/B testing may specify revisions for a subset of repositories and/or some A/B testing results may appear as if it goes back in time with respect to other A/B testing results. For example, consider creating two A/B test groups for WebKit changes and OS changes separately. There could be no coherent linearization of those two A/B testing in which both WebKit and OS versions move forward. (AnalysisResultsViewer.RootSetInTestGroup): Added. Represents a pair (test group, root set) since a root set could be shared by multiple test groups. (AnalysisResultsViewer.TestGroupStackingBlock): Added. A stacked block representing a test group. (AnalysisResultsViewer.TestGroupStackingBlock.prototype.addRowIndex): Associates a row number with either set A or set B. (AnalysisResultsViewer.TestGroupStackingBlock.prototype.createStackingCell): Creates a table cell for this block. (AnalysisResultsViewer.TestGroupStackingBlock.prototype.isThin): Returns true if this test group has failed and this block should look "thin" without any label. (AnalysisResultsViewer.TestGroupStackingBlock.prototype._computeTestGroupStatus): Computes the status for this test group. (AnalysisResultsViewer.TestGroupStackingGrid): Added. AnalysisResultsViewer uses this class to layout blocks representing test groups. (AnalysisResultsViewer.TestGroupStackingGrid.prototype.insertBlockToColumn): Inserts a new block to layout. We keep all test groups doing the same A/B test next to each other. (AnalysisResultsViewer.TestGroupStackingGrid.prototype.layout): Layouts each block / test group in the order they are created. (AnalysisResultsViewer.TestGroupStackingGrid.prototype._layoutBlock): Places the block in the left-most column that can accommodate it while avoiding columns of a different thin-ness. A column is thin if its A/B testing has failed, and not thin otherwise. (AnalysisResultsViewer.TestGroupStackingGrid.prototype.createCellsForRow): Creates table cells for a given row. For each column, generate a table cell if we're in the first row and the first block starts in a later row, a block starts in the current row, or the last block ended in the previous row and the next block or the last row appears later. * public/v3/components/bar-graph-group.js: Added. A component for showing a group of bar graphs. (BarGraphGroup): Added. Creates a group of bar graphs with the same value range. It's used by AnalysisResultsViewer and ResultsTable to show bar graphs to compare values. (SingleBarGraph): A component created and collectively controlled by BarGraphGroup. * public/v3/components/results-table.js: Added. (ResultsTable): An abstract superclass for TestGroupResultsTable and AnalysisResultsViewer. (ResultsTable.prototype.render): Renders the table. 1. Call "buildRowGroups()" implemented by a subclass to obtain the list of rows. 2. Compute the list of repositories to show. 3. For each cell in the table, compute the number of rows to show the same value (for rowspan). 4. Render the table with an extra list of repositories if exists. (ResultsTable.prototype._computeRepositoryList): Compute the list of repositories to list revisions in the table. Omit repositories not present in any row or for which all rows have the same revision. In the latter case, include it in the extra repositories listed below the table. This minimizes the amount of redundant information presented to the user. (ResultsTableRow): Added. Represents a single row in the table. ResultsTable constructs necessary table cells to tabulate the associated root sets, and shows the associated result using a grouped bar graph. Additional columns are used by AnalysisResultsViewer to show stacked blocks for A/B testing groups. * public/v3/components/test-group-results-table.js: Added. (TestGroupResultsTable): (TestGroupResultsTable.prototype.didUpdateResults): (TestGroupResultsTable.prototype.setTestGroup): (TestGroupResultsTable.prototype.heading): (TestGroupResultsTable.prototype.render): (TestGroupResultsTable.prototype.buildRowGroups): * public/v3/index.html: * public/v3/models/analysis-results.js: Added. (AnalysisResults): Added. Like MeasurementSet, this class represents a set of measured values associated with a given analysis task. (AnalysisResults.prototype.find): Returns a measured valued for a given build and metric. (AnalysisResults.prototype.add): Adds a new measured value. Used by AnalysisResults.fetch. (AnalysisResults.fetch): Fetches data and creates AnalysisResults for a given analysis task. * public/v3/models/analysis-task.js: (AnalysisTask.prototype.startMeasurementId): Added. (AnalysisTask.prototype.endMeasurementId): Added. (AnalysisTask.fetchByBuildRequestId): Added. (AnalysisTask._fetchSubset): Uses DataModelObject.cachedFetch. * public/v3/models/build-request.js: Added. (BuildRequest): Added. Represents a single A/B testing request associated with a test group. * public/v3/models/builder.js: (Build): Added. Represents a build associated with a given A/B testing result. * public/v3/models/commit-log.js: (CommitLog): Made this class inherit from DataModelObject. (CommitLog.ensureSingleton): Added. Finds the singleton object created for a given revision in the specified repository. This helps RootSet and other classes compare commits fast. (CommitLog.prototype.repository): Added. (CommitLog.fetchBetweenRevisions): Uses CommitLog.ensureSingleton. * public/v3/models/data-model.js: (DataModelObject): (DataModelObject.namedStaticMap): Added. (DataModelObject.ensureNamedStaticMap): Renamed from namedStaticMap instead of implicitly assuming that the non-static version always creates the map. (DataModelObject.prototype.namedStaticMap): Added. (DataModelObject.cachedFetch): Extracted from AnalysisTask._fetchSubset so that TestGroup's fetchByTask could also use it. (LabeledObject): * public/v3/models/measurement-adaptor.js: Added. (MeasurementAdaptor): Extracted from MeasurementCluster. This class is responsible for re-formatting the data received via /api/measurement-set JSON API inside the v3 UI. (MeasurementAdaptor.prototype.extractId): Added. (MeasurementAdaptor.prototype.adoptToAnalysisResults): Added. Used by AnalysisResults. (MeasurementAdaptor.aggregateAnalysisResults): Added. Used by TestGroupResultsTable to aggregate results for each test configuration; e.g. computing the average for set A. (MeasurementAdaptor.prototype.adoptToSeries): Extracted from MeasurementCluster.addToSeries. Added rootSet() to each point. This allows AnalysisResultsViewer to compare them against root sets associated with A/B testing results. (MeasurementAdaptor.computeConfidenceInterval): Moved from MeasurementCluster. * public/v3/models/measurement-cluster.js: (MeasurementCluster): (MeasurementCluster.prototype.addToSeries): * public/v3/models/repository.js: (Repository.prototype.hasUrlForRevision): Added. * public/v3/models/root-set.js: Added. (RootSet): Added. Represents a set of commits in measured results. (MeasurementRootSet): Added. Ditto for results associated with A/B testing. * public/v3/models/test-group.js: Added. (TestGroup): Added. Represents a A/B testing on analysis task. (TestGroup.prototype.createdAt): Added. (TestGroup.prototype.buildRequests): Returns the list of build requests associated with this A/B testing. (TestGroup.prototype.addBuildRequest): Added. Used by BuildRequest's constructor to associate itself with this group. (TestGroup.prototype.didSetResult): Added. Called by BuildRequest.setResult when measured values are fetched and associated with a build request in this group. * public/v3/models/test.js: (Test): * public/v3/pages/analysis-task-page.js: (AnalysisTaskPage): (AnalysisTaskPage.prototype.updateFromSerializedState): Fetch the analysis task, test groups associated with it, and all A/B testing results based on the task id or the build request id specified in the URL. (AnalysisTaskPage.prototype._didFetchTask): Added. Start fetching the measured data. This is the data on charts page for which this analysis task was created, not results of A/B testing. (AnalysisTaskPage.prototype._didFetchMeasurement): Added. Display the fetched data in a table inside AnalysisResultsViewer. (AnalysisTaskPage.prototype._didFetchTestGroups): Added. Display the list of A/B test groups as well as the results of the first A/B testing. (AnalysisTaskPage.prototype._didFetchAnalysisResults): Added. (AnalysisTaskPage.prototype._assignTestResultsIfPossible): Added. Once both the analysis task, A/B test groups as well as their results are fetched, update build requests in each test group with their results. (AnalysisTaskPage.prototype.render): Show the list of test groups and highlight the currently selected one. (AnalysisTaskPage.prototype._showTestGroup): Added. A callback used by AnalysisResultsViewer and TestGroupResultsTable to notify this class when the user selects a new test group. (AnalysisTaskPage.htmlTemplate): Updated the template. (AnalysisTaskPage.cssTemplate): Ditto. * public/v3/pages/charts-page.js: (ChartsPage.createStateForAnalysisTask): Added. Creates a URL state object for opening a chart associated with an analysis task. 2015-12-22 Ryosuke Niwa Analysis task page is slow to load https://bugs.webkit.org/show_bug.cgi?id=152517 Reviewed by Andreas Kling. The slowness comes from r194130 which made the JSON API at /api/analysis-tasks to report the start and the end of each analysis task. This query was adding ~2s to the total JSON generation time. Cache these values on analysis_task table since they never change once an analysis task is created. * init-database.sql: Added columns task_start_run_time and task_end_run_time to analysis_task table. Also added the missing drop statements at the top. * public/api/analysis-tasks.php: (fetch_and_push_bugs_to_tasks): Don't fetch the latest commit time of the start and the end. (format_task): Report task_start_run_time and task_end_run_time as startRunTime and endRunTime. * public/privileged-api/create-analysis-task.php: (main): Set start_run_time and end_run_time when creating an analysis task. (time_for_run): Added. 2015-12-17 Ryosuke Niwa v3 UI shouldn't open/close pane selector by mouseenter/leave https://bugs.webkit.org/show_bug.cgi?id=152399 Reviewed by Andreas Kling. Removed the code to open and close the pane selector by mouseenter and mouseleave since multiple people have complained about the behavior. * public/v3/pages/charts-toolbar.js: (ChartsToolbar): Removed the event listeners. (ChartsToolbar.prototype._addPane): Don't close the pane selector when adding a new pane to better support the use case of adding multiple panes. (ChartsToolbar.cssTemplate): Tweaked CSS. 2015-12-17 Ryosuke Niwa Popover for analysis tasks shows up at the left edge of annotation bars in the v3 UI https://bugs.webkit.org/show_bug.cgi?id=152389 Reviewed by Darin Adler. Compute the x coordinate of the popover from the center of each annotation bar. Also adjust the x coordinate to keep the popover within the charts. * public/v3/components/interactive-time-series-chart.js: (InteractiveTimeSeriesChart.prototype._renderChartContent): 2015-12-17 Ryosuke Niwa Dashboard charts should have uniform widths on v3 UI https://bugs.webkit.org/show_bug.cgi?id=152395 Reviewed by Chris Dumez. Fix the bug by applying table-layout: fixed on the dashboard table. * public/v3/pages/dashboard-page.js: (DashboardPage.prototype.render): Added header-column as a class name to explicitly set the header column with. (DashboardPage.cssTemplate): Adjusted CSS accordingly. 2015-12-17 Ryosuke Niwa Closing a pane on v3 UI always closes the last pane https://bugs.webkit.org/show_bug.cgi?id=152388 Reviewed by Chris Dumez. The bug was caused by closePane being called without arguments. (The first argument to bind is "this" value.) Fixed it by passing in "this" pane object to the first argument. * public/v3/pages/chart-pane.js: (ChartPane): 2015-12-16 Ryosuke Niwa Perf Dashboard v3 UI doesn't show recent data points on v2 UI https://bugs.webkit.org/show_bug.cgi?id=152368 Reviewed by Chris Dumez. The bug was caused by the last modified date in measurement set JSON being a string instead of a POSIX timestamp, which prevented the v3 UI from invalidating the cache. Specifically, the following boolean logic always evaluated to false because +data['lastModified'] was NaN in MeasurementSet.prototype._fetch (/v3/models/measurement-set.js): !clusterEndTime && useCache && +data['lastModified'] < self._lastModified Fixed the bug by calling Database::to_js_time on the last modified date fetched from the database. * public/api/measurement-set.php: (MeasurementSetFetcher::fetch_config_list): Convert the string returned by the database to a POSIX timestamp. * tests/api-measurement-set.js: Added a test to ensure the last modified date in JSON is numeric. Since the value of the last modified date depends on when tests run, we can't assert it to be a certain value. 2015-12-16 Ryosuke Niwa v3 UI should show and link the build number on charts page https://bugs.webkit.org/show_bug.cgi?id=152359 Reviewed by Chris Dumez. Show the hyperlinked build number in the v3 UI. * public/v3/models/builder.js: (Builder): Renamed _buildURL to _buildUrlTemplate. (Builder.prototype.urlForBuild): Added. * public/v3/pages/chart-pane-status-view.js: (ChartPaneStatusView): (ChartPaneStatusView.prototype.render): Added the code to render hyperlinked build number when one is available. (ChartPaneStatusView.prototype.computeChartStatusLabels): Store currentPoint's measurement object as _buildInfo if the current point is set by an indicator (not by a selection). 2015-12-16 Ryosuke Niwa v3 dashboard doesn't stretch charts to fill the screen https://bugs.webkit.org/show_bug.cgi?id=152354 Reviewed by Chris Dumez. The bug was caused by a workaround to avoid canvas stretching table cell too much. Fix the problem instead by making the canvas absolutely positioned inside the "time-series-chart" element so that it does not contribute to the intrinsic/natural width of the cell. * public/v3/components/time-series-chart.js: (TimeSeriesChart.prototype._ensureCanvas): Make the canvas absolutely positioned inside the shadow root. (TimeSeriesChart.prototype._updateCanvasSizeIfClientSizeChanged): Use the container element's size now that the canvas does not resize with it. * public/v3/pages/dashboard-page.js: (DashboardPage.cssTemplate): Updated the CSS so that the chart stretches all the way. 2015-12-16 Ryosuke Niwa The chart status on v3 UI sometimes show wrong revision ranges https://bugs.webkit.org/show_bug.cgi?id=152331 Reviewed by Chris Dumez. The bug was caused by the status view not taking the data sampling that happens in TimeSeriesChart into account when finding the previous point. Take this into account by using InteractiveTimeSeries.currentPoint(-1) which finds the sampled data point immediately preceding the current point (at which the indicator is shown). * public/v3/components/chart-status-view.js: (ChartStatusView.prototype.updateStatusIfNeeded): 2015-12-15 Ryosuke Niwa Perf dashboard's cycler page should use v3 UI https://bugs.webkit.org/show_bug.cgi?id=152324 Reviewed by Chris Dumez. Use the v3 UI in cycler.html after r194130. * public/cycler.html: * public/v3/index.html: Removed the reference to a non-existent platform-selector.js. 2015-12-15 Ryosuke Niwa Add v3 UI to perf dashboard https://bugs.webkit.org/show_bug.cgi?id=152311 Reviewed by Chris Dumez. Add the third iteration of the perf dashboard UI. UI for viewing and modifying analysis tasks is coming soon. The v3 UI is focused on speed, and removes all third-party script dependencies including jQuery, d3, and Ember. Both the DOM-based UI and graphing are implemented manually. The entire app is structured using new component library implemented in components/base.js. Each component is an instance of a subclass of ComponentBase which owns a single DOM element. Each subclass may supply static methods named htmlTemplate and cssTemplate as the template for a component instance. ComponentBase automatically clones the templates inside the associated element (or its shadow root on the supported browsers). Each subclass must supply a method called "render()" which constructs and updates the DOM as needed. There is a special component called Page, which represents an entire page. Each Page is opened by PageRouter's "route()" function. Each subclass of Page supplies "open()" for initialization and "updateFromSerializedState()" for a hash URL transition. The key feature of the v3 UI is the split of time series into chunks called clusters (see r194120). On an internal instance of the dashboard, the v2 UI downloads 27MB of data whereas the same page loads only 3MB of data in the v3. The key logic for fetching time series in chunks is implemented by MeasurementSet in /v3/models/measurement-set.js. We first fetch the cached primary cluster (the cluster that contains the newest data) at: /data/measurement-set--.json If that's outdated according to lastModified in manifest.json, then we immediately re-fetch the primary cluster at: /api/measurement-set/?platform=&metric= Once the up-to-date primary cluster is fetched, we fetch all "secondary" clusters. For each cluster being fetched, including the primary, we invoke registered callbacks. In addition, the v3 UI reduces the initial page load time by loading a single bundled JS file generated by tools/bundle-v3-scripts.py. index.html has a fallback to load all 44 JS files individually during development. * public/api/analysis-tasks.php: (fetch_and_push_bugs_to_tasks): Added the code to fetch start and end run times. This is necessary in V3 UI because no longer fetch the entire time series. See r194120 for the new measurement set JSON API. (format_task): Compute the category of an analysis task based on "result" value. This will be re-vamped once I add the UI for the analysis task page in v3. * public/include/json-header.php: (require_format): CamelCase the name. (require_match_one_of_values): Ditto. (validate_arguments): Renamed from require_existence_of and used in measurement-set.php landed in r194120. * public/v3: Added. * public/v3/components: Added. * public/v3/components/base.js: Added. (ComponentBase): The base component class. (ComponentBase.prototype.element): Returns the DOM element associated with the DOM element. (ComponentBase.prototype.content): Returns the shadow root if one exists and the associated element otherwise. (ComponentBase.prototype.render): To be implemented by a subclass. (ComponentBase.prototype.renderReplace): A helper function to "render" DOM contents. (ComponentBase.prototype._constructShadowTree): Called inside the constructor to instantiate the templates. (ComponentBase.prototype._recursivelyReplaceUnknownElementsByComponents): Instantiates components referred by its element name inside the instantiated content. (ComponentBase.isElementInViewport): A helper function. Returns true if the element is in the viewport and it has non-zero width and height. (ComponentBase.defineElement): Defines a custom element that can be automatically instantiated from htmlTemplate. (ComponentBase.createElement): A helper function to create DOM tree to be used in "render()" method. (ComponentBase._addContentToElement): A helper for "createElement". (ComponentBase.createLink): A helper function to create a hyperlink or another clickable element (via callback). (ComponentBase.createActionHandler): A helper function to create an event listener that prevents the default action and stops the event propagation. * public/v3/components/button-base.js: Added. * public/v3/components/chart-status-view.js: Added. (ChartStatusView): A component that reports the current status of time-series-chart. It's subclasses by ChartPaneStatusView to provide additional information in the charts page's panes. * public/v3/components/close-button.js: Added. (CloseButton): * public/v3/components/commit-log-viewer.js: Added. (CommitLogViewer): A component that lists commit revisions along with commit messages for a range of data points. * public/v3/components/interactive-time-series-chart.js: Added. (InteractiveTimeSeriesChart): A subclass of InteractiveTimeSeriesChart with interactivity (selection & indicator). Selection and indicator are mutually exclusive. * public/v3/components/pane-selector.js: Added. (PaneSelector): A component for selecting (platform, metric) pair to add in the charts page. * public/v3/components/spinner-icon.js: Added. * public/v3/components/time-series-chart.js: Added. (TimeSeriesChart): A canvas-based chart component without interactivity. It takes a source list and options as the constructor arguments. A source list is a list of measurement sets (measurement-set.js) with drawing options. This component fetches data via MeasurementSet.fetchBetween inside TimeSeriesChart.prototype.setDomain and progressively updates the charts as more data arrives. The canvas is updated on animation frame via rAF and all layout and rendering metrics are lazily computed in _layout. In addition, this component samples data before rendering the chart when there are more data points per pixel in _ensureSampledTimeSeries. * public/v3/index.html: Added. Loads bundled-scripts.js if it exists, or individual script files otherwise. * public/v3/instrumentation.js: Added. This class is used to gather runtime statistics of v3 UI. (It measures the performance of the perf dashboard UI). * public/v3/main.js: Added. Bootstraps the app. (main): (fetchManifest): * public/v3/models: Added. * public/v3/models/analysis-task.js: Added. * public/v3/models/bug-tracker.js: Added. * public/v3/models/bug.js: Added. * public/v3/models/builder.js: Added. * public/v3/models/commit-log.js: Added. * public/v3/models/data-model.js: Added. (DataModelObject): The base class for various data objects that correspond to database tables. It supplies static hash map to find entries by id as well as other keys. (LabeledObject): A subclass of DataModelObject with the capability to find an object via its name. * public/v3/models/measurement-cluster.js: Added. (MeasurementCluster): Represents a single cluster or a chunk of data in a measurement set. * public/v3/models/measurement-set.js: Added. (MeasurementSet): Represents a measurement set. (MeasurementSet.findSet): Returns the singleton set given (metric, platform). We use singleton to avoid issuing multiple HTTP requests for the same JSON when there are multiple TimeSeriesChart that show the same graph (e.g. on charts page with overview and main charts). (MeasurementSet.prototype.findClusters): Finds the list of clusters to fetch in a given time range. (MeasurementSet.prototype.fetchBetween): Fetch clusters for a given time range and calls callback whenever new data arrives. The number of callbacks depends on the how many clusters need to be newly fetched. (MeasurementSet.prototype._fetchSecondaryClusters): Fetches non-primary (non-latest) clusters. (MeasurementSet.prototype._fetch): Issues a HTTP request to fetch a cluster. (MeasurementSet.prototype._didFetchJSON): Called when a cluster is fetched. (MeasurementSet.prototype._failedToFetchJSON): Called when the fetching of a cluster has failed. (MeasurementSet.prototype._invokeCallbacks): Invokes callbacks upon an approval of a new cluster. (MeasurementSet.prototype._addFetchedCluster): Adds the newly fetched cluster in the order. (MeasurementSet.prototype.fetchedTimeSeries): Returns a time series that contains data from all clusters that have been fetched. (TimeSeries.prototype.findById): Additions to TimeSeries defined in /v2/data.js. (TimeSeries.prototype.dataBetweenPoints): Ditto. (TimeSeries.prototype.firstPoint): Ditto. * public/v3/models/metric.js: Added. * public/v3/models/platform.js: Added. * public/v3/models/repository.js: Added. * public/v3/models/test.js: Added. * public/v3/pages: Added. * public/v3/pages/analysis-category-page.js: Added. The "Analysis" page that lists the analysis tasks. * public/v3/pages/analysis-category-toolbar.js: Added. The toolbar to filter analysis tasks based on its category (unconfirmed, bisecting, identified, closed) and a keyword. * public/v3/pages/analysis-task-page.js: Added. Not implemented yet. It just has the hyperlink to the v2 UI. * public/v3/pages/chart-pane-status-view.js: Added. (ChartPaneStatusView): A subclass of ChartStatusView used in the charts page. In addition to the current value, comparison to baseline/target, it shows the list of repository revisions (e.g. WebKit revision, OS version). * public/v3/pages/chart-pane.js: Added. (ChartPane): A component a pane in the charts page. Each pane has the overview chart and the main chart. The zooming is synced across all panes in the charts page. * public/v3/pages/charts-page.js: Added. Charts page. * public/v3/pages/charts-toolbar.js: Added. The toolbar to set the number of days to show. This affects the overview chart's domain in each pane. * public/v3/pages/create-analysis-task-page.js: Added. (CreateAnalysisTaskPage): A page that gets shown momentarily while creating a new analysis task. * public/v3/pages/dashboard-page.js: Added. A dashboard page. * public/v3/pages/dashboard-toolbar.js: Added. Its toolbar with buttons to select the number of days to show. * public/v3/pages/domain-control-toolbar.js: Added. An abstract superclass of charts and dashboard toolbars. * public/v3/pages/heading.js: Added. A component for displaying the header and toolbar, if exists, on each page. * public/v3/pages/page-router.js: Added. This class is responsible for updating the URL hashes as well as opening and updating each page when the hash changes (via back/forward navigation). * public/v3/pages/page-with-charts.js: Added. An abstract subclass of page used by dashboards and charts page. Supplies helper functions for creating TimeSeriesChart options. * public/v3/pages/page-with-heading.js: Added. An abstract subclass of page that uses the heading component. * public/v3/pages/page.js: Added. The Page component. * public/v3/pages/toolbar.js: Added. An abstract toolbar component. * public/v3/remote.js: Added. (getJSON): Fetches JSON from the remote server. (getJSONWithStatus): Ditto. Rejects the response if the status is not "OK". (PrivilegedAPI.sendRequest): Posts a HTTP request to a privileged API in /privileged-api/. (PrivilegedAPI.requestCSRFToken): Creates a new CSRF token to request a privileged API post. * tools/bundle-v3-scripts.py: Added. (main): Bundles js files together and minifies them by jsmin.py for the v3 UI. Without this script, we're forced to download 44 JS files or making each JS file contain multiple classes. * tools/jsmin.py: Copied from WebInspector / JavaScriptCore code. 2015-12-15 Ryosuke Niwa Fix v2 UI after r194093. * public/v2/data.js: 2015-12-15 Ryosuke Niwa Add /api/measurement-set for v3 UI https://bugs.webkit.org/show_bug.cgi?id=152312 Rubber-stamped by Chris Dumez. The new API JSON allows the front end to fetch measured data in chunks called a "cluster" as specified in config.json for each measurement set specified by the pair of a platform and a metric. When the front end needs measured data in a given time range (t_0, t_1) for a measurement set, it first fetches the primary cluster by /api/measurement-set/?platform=&metric=. The primary cluster is the last cluster in the set (returning the first cluster here is not useful since we don't typically show very old data), and provides the information needed to fetch other clusters. Fetching the primary cluster also creates JSON files at: /data/measurement-set---.json to allow latency free access for secondary clusters. The front end code can also fetch the cache of the primary cluster at: /data/measurement-set--.json. Because the front end code has to behave as if all data is fetched, each cluster contains one data point immediately before the first data point and one immediately after the last data point. This avoids having to fetch multiple empty clusters for manually specified baseline data. To support this behavior, we generate all clusters for a given measurement set at once when the primary cluster is requested. Furthermore, all measurement sets are divided at the same time into clusters so that the boundary of clusters won't shift as more data are reported to the server. * config.json: Added clusterStart and clusterSize as options. * public/api/measurement-set.php: Added. (main): (MeasurementSetFetcher::__construct): (MeasurementSetFetcher::fetch_config_list): Finds configurations that belongs to this (platform, metric) pair. (MeasurementSetFetcher::at_end): Returns true if we've reached the end of all clusters for this set. (MeasurementSetFetcher::fetch_next_cluster): Generates the JSON data for the next cluster. We generate clusters in increasing chronological order (the oldest first and the newest last). (MeasurementSetFetcher::execute_query): Executes the main query. (MeasurementSetFetcher::format_map): Returns the mapping of a measurement field to an array index. This removes the need to have key names for each measurement and reduces the JSON size by ~10%. (MeasurementSetFetcher::format_run): Creates an array that contains data for a single measurement. The order matches that of keys in format_map. (MeasurementSetFetcher::parse_revisions_array): Added. Copied from runs.php. * tests/api-measurement-set.js: Added. Added tests for /api/measurement-set. 2015-12-14 Ryosuke Niwa Using fake timestamp in OS version make some results invisible https://bugs.webkit.org/show_bug.cgi?id=152289 Reviewed by Stephanie Lewis. Fix various bugs after r194088. * public/api/commits.php: (format_commit): Include the commit order. * public/v2/data.js: (CommitLogs._cacheConsecutiveCommits): Sort by commit order when commit time is missing. * tools/pull-os-versions.py: (OSBuildFetcher._assign_order): Use integer instead of fake time for commit order. (available_builds_from_command): Exit early when an exception is thrown. 2015-12-14 Ryosuke Niwa Fix a typo in the previous commit. * public/include/report-processor.php: 2015-12-14 Ryosuke Niwa Build fix after r192965. Suppress a warning about log being referred to as a closure variable. * public/include/report-processor.php: 2015-12-14 Ryosuke Niwa Using fake timestamp in OS version make some results invisible https://bugs.webkit.org/show_bug.cgi?id=152289 Reviewed by Stephanie Lewis. Added commit_order column to explicitly order OS versions. This fixes the bug whereby which baseline results reported with only OS versions are shown with x coordinate set to 10 years ago. To migrate the existing database, run: ALTER TABLE commits ADD COLUMN commit_order integer; CREATE INDEX commit_order_index ON commits(commit_order); Then for each repository $1, UPDATE commits SET (commit_time, commit_order) = (NULL, CAST(EXTRACT(epoch from commit_time) as integer)) WHERE commit_repository = $1; * init-database.sql: Added the column. * public/api/commits.php: (fetch_commits_between): Use commit_order to order commits when commit_time is missing. * public/api/report-commits.php: (main): Set commit_order. * tools/pull-os-versions.py: (OSBuildFetcher.fetch_and_report_new_builds): (OSBuildFetcher._assign_order): Renamed from _assign_fake_timestamps. Set the order instead of a fake timestmap. 2015-12-14 Ryosuke Niwa Perf dashboard can't merge when the destination platform is missing baseline/target https://bugs.webkit.org/show_bug.cgi?id=152286 Reviewed by Stephanie Lewis. The bug was caused by the query to migrate test configurations to new platform checking configuration type and metric separately; that is, it assumes the configuration exists only if either the same type or the same metric exists in the destination. Fixed the bug by checking both conditions simultaneously for each configuration. * public/admin/platforms.php: * tests/admin-platforms.js: Added a test. 2015-12-11 Ryosuke Niwa Perf dashboard's buildbot sync config JSON duplicates too much information https://bugs.webkit.org/show_bug.cgi?id=152196 Reviewed by Stephanie Lewis. Added shared, per-builder, and per-test (called type) configurations. * tools/sync-with-buildbot.py: (load_config): (load_config.merge): 2015-12-02 Ryosuke Niwa Perf dashboard should avoid overflow during geometric mean computation https://bugs.webkit.org/show_bug.cgi?id=151773 Reviewed by Chris Dumez. * public/include/report-processor.php: 2015-11-30 Ryosuke Niwa Perf dashboard should extend baseline and target to the future https://bugs.webkit.org/show_bug.cgi?id=151511 Reviewed by Darin Adler. * public/v2/data.js: (RunsData.prototype.timeSeriesByCommitTime): Added extendToFuture as an argument. (RunsData.prototype.timeSeriesByBuildTime): Ditto. (RunsData.prototype._timeSeriesByTimeInternal): Ditto. (TimeSeries): Add a new point to the end if extendToFuture is set and the series is not empty. * public/v2/manifest.js: (App.Manifest._formatFetchedData): Set extendToFuture to true for baselines and targets. 2015-11-30 Ryosuke Niwa Perf dashboard should always show comparison to baseline and target even if one is missing https://bugs.webkit.org/show_bug.cgi?id=151510 Reviewed by Darin Adler. Show the comparison status against the baseline when baseline is present but target is missing. To make the code more readable, this patch splits the logic into three cases: 1. Both baseline and target are present 2. Only baseline is present 3. Only target is present Also extracted a helper function to construct the label. * public/v2/app.js: (.labelForDiff): Added. (App.Pane.computeStatus): 2015-11-23 Commit Queue Unreviewed, rolling out r192716 and r192717. https://bugs.webkit.org/show_bug.cgi?id=151582 The patch was incorrect. We always need at least one data point in each configuration (Requested by rniwa on #webkit). Reverted changesets: "Perf dashboard's should not include results more than 366 days old in JSON" https://bugs.webkit.org/show_bug.cgi?id=151529 http://trac.webkit.org/changeset/192716 "Build fix for old version of PHP." http://trac.webkit.org/changeset/192717 2015-11-20 Ryosuke Niwa Build fix for old version of PHP. * public/api/runs.php: 2015-11-20 Ryosuke Niwa Perf dashboard's should not include results more than 366 days old in JSON https://bugs.webkit.org/show_bug.cgi?id=151529 Reviewed by Timothy Hatcher. Don't return results more than 366 days old in /api/runs/ JSON API. This is a ~5% runtime improvement and reduces the JSON file size by 20-50% in the internal perf dashboard. * public/api/runs.php: (main): Added the support for "?noResults" to avoid echoing results. This is useful for debugging. Also instantiate RunsGenerator before issuing the query to find all configurations so that the runtime cost of doing so will be included in elapsedTime. (RunsGenerator::fetch_runs): Skip a row when its build and commit times are more than 366 days old. (RunsGenerator::format_run): Takes build_time and revisions as arguments since fetch_runs uses them now. (RunsGenerator::parse_revisions_array): Compute the max of commit times. 2015-11-20 Ryosuke Niwa Remove chartPointRadius from interactive chart component https://bugs.webkit.org/show_bug.cgi?id=151480 Reviewed by Darin Adler. Replaced the parameter by CSS rules. * public/v2/chart-pane.css: (.chart .dot): (.chart .dot.foreground): (.chart .highlight): (.chart .extent): * public/v2/index.html: * public/v2/interactive-chart.js: (App.InteractiveChartComponent.Ember.Component.extend._constructGraphIfPossible): (App.InteractiveChartComponent.Ember.Component.extend._highlightedItemsChanged): 2015-11-20 Ryosuke Niwa Perf dashboard's runs API uses more than 128MB of memory https://bugs.webkit.org/show_bug.cgi?id=151478 Reviewed by Andreas Kling. Don't fetch all query results at once to avoid using twice as much memory as needed. Use iterative API to format each result at a time. This change is also a 5% runtime performance gain. * public/api/runs.php: (RunsGenerator::__construct): Takes a Database instance instead of a list of configurations. The latter is no longer needed as we pass in each configuration type explicitly to fetch_runs. (RunsGenerator::fetch_runs): Renamed from add_runs since it now executes the database query via execute_query. Also moved the logic to compute the last modified time here. (RunsGenerator::execute_query): Moved from fetch_runs_for_config. Use Database::query instead of query_and_fetch_all. (RunsGeneratorForTestGroup): (RunsGeneratorForTestGroup::__construct): (RunsGeneratorForTestGroup::execute_query): Moved from fetch_runs_for_config_and_test_group. * public/include/db.php: (generate_data_file): Lock the file to avoid corruption. 2015-11-19 Ryosuke Niwa Perf dashboard always fetches charts JSON twice https://bugs.webkit.org/show_bug.cgi?id=151483 Reviewed by Andreas Kling. Only re-generate "runs" JSON via /api/runs/ when the cache doesn't exist in /data/ or the cached JSON is obsolete (shouldRefetch is set true) or corrupt (the second closure). * public/v2/app.js: (App.Pane._fetch): 2015-11-18 Ryosuke Niwa Internal perf dashboard takes forever to load https://bugs.webkit.org/show_bug.cgi?id=151430 Rubber-stamped by Antti Koivisto. Fix a few performance problems with the perf dashboard v2 UI. * public/v2/app.js: (App.DashboardRow._createPane): Set "inDashboard" to true. (App.Pane._fetch): Immediately show the cached chart instead of waiting for the refetched data which invokes a PHP JSON API. Also don't fetch the analysis tasks when the chart is shown in the dashboard since we don't show annotate charts in the dashboard. 2015-10-15 Ryosuke Niwa Unreviewed fix of a test after r190687. * tests/admin-regenerate-manifest.js: 2015-10-12 Ryosuke Niwa Perf dashboard tools shouldn't require server credentials in multiple configuration files https://bugs.webkit.org/show_bug.cgi?id=149994 Reviewed by Chris Dumez. Made detect-changes.js and pull-svn.py pull username and passwords from the server config JSON to reduce the number of JSON files that need to include credentials. Also made each script reload the server config after sleep to allow dynamic credential updates. In addition, change the server config JSON's format to include scheme, host, and port numbers separately instead of a url since detect-changes.js needs each value separately. This reduces the number of JSONs with credentials to two for our internal dashboard. * tools/detect-changes.js: (main): Added a property argument parsing. Now takes --server-config-json, --change-detection-config-json, and --seconds-to-sleep like other scripts. (parseArgument): Added. (fetchManifestAndAnalyzeData): Reload the server config JSON. (loadServerConfig): Added. Set settings.perfserver and settings.slave from the server config JSON. Also add settings.perfserver.host to match the old format. (configurationsForTesting): Fixed a bug that we throw an exception when a dashboard contains an empty cell. * tools/pull-os-versions.py: (main): Use load_server_config after each sleep. * tools/pull-svn.py: (main): Use load_server_config after each sleep. (fetch_commits_and_submit): Use the perf dashboard's auth as subversion credential when useServerAuth is set. * tools/sync-with-buildbot.py: (main): Use load_server_config after each sleep. * tools/util.py: (load_server_config): Extracted from python scripts. Computes server's url from scheme, host, and port number to match the old format python scripts except. 2015-10-11 Ryosuke Niwa Build fix after r190817. Now that pull-os-versions store fake timestamps, we need to bypass timestamp checks for OS versions when bots try to report new results. Otherwise, we fail to process the reports with a MismatchingCommitTime error. * public/include/report-processor.php: (ReportProcessor::resolve_build_id): 2015-10-08 Ryosuke Niwa Perf dashboard erroneously shows an old OS build in A/B testing range https://bugs.webkit.org/show_bug.cgi?id=149942 Reviewed by Darin Adler. Ordering OS builds lexicologically turned out be a bad idea since 15A25 falls between 15A242 and 15A251. Use a fake/synthetic timestamp to force the commonly understood total order instead. Refactored pull-os-versions.py to share the server config JSON with other scripts. Also made the script support pulling multiple sources; e.g. both OS X and iOS. Also removed superfluous feature to submit results in chunks. The perf dashboard can handle thousands of revisions being submitted at once just fine. * public/api/commits.php: (main): A partial revert of r185574 since we no longer need to order builds lexicologically. * tools/pull-os-versions.py: (main): Takes --os-config-json, --server-config-json, and --seconds-to-sleep as arguments instead of a single --config argument to share the server config JSON with other scripts. (OSBuildFetcher): Extracted out of main. This class is instantiated for each OS kind (e.g. OS X). (OSBuildFetcher.__init__): Added. (OSBuildFetcher._fetch_available_builds): Extracted out of main. Fetches available builds from a website or custom commands. (OSBuildFetcher.fetch_and_report_new_builds): Extracted out of main. Submits the fetched builds after filtering out the ones we've already reported. (OSBuildFetcher._assign_fake_timestamps): Creates a fake timestamp to establish a total order amongst each OS X / iOS style build number such as 12A3456b. 2015-10-08 Ryosuke Niwa pull-svn.py fails to sync revisions when SVN credentials is not setup https://bugs.webkit.org/show_bug.cgi?id=149941 Reviewed by Chris Dumez. Added the support for specifying subversion credentials. Also added the support for pulling from multiple subversion servers. Subversion servers are specified in a JSON configuration file specified by --svn-config formatted as follows: [ { "name": "WebKit", "url": "http://svn.webkit.org/repository/webkit", "username": "webkitten", "password": "webkitten's password", "trustCertificate": true, "accountNameFinderScript": ["python", "/Volumes/Data/WebKit/Tools/Scripts/webkit-patch", "find-users"] }, ... ] In addition, refactored it to use the shared server config JSON for the dashboard access. * tools/pull-svn.py: (main): Now takes --svn-config-json, --server-config-json, --seconds-to-sleep and --max-fetch-count as required options instead of seven unnamed arguments. (fetch_commits_and_submit): Extracted from main. Fetches at most max_fetch_count new revisions from the subversion server, and submits them in accordance with server_config. (fetch_commit_and_resolve_author): Now takes a single repository dictionary instead of two separate arguments for name and URL to pass down the repository's authentication info to fetch_commit. (fetch_commit): Ditto. Add appropriate arguments when username and passwords are specified. (resolve_author_name_from_account): Use a list argument instead of a single string argument now that the argument comes from a JSON instead of sys.argv. 2015-10-07 Ryosuke Niwa Unreviewed race condition fix. Exit early when xScale or yScale is not defined. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._updateRangeBarRects): 2015-10-07 Ryosuke Niwa Add a page that cycles through v2 dashboards https://bugs.webkit.org/show_bug.cgi?id=149907 Reviewed by Chris Dumez. Add cycler.html that goes through each dashboard on v2 UI. This allows the dashboards to be cycled through on a TV screen. * public/cycler.html: Added. (loadURLAt): Appends a new iframe to load the next URL (i is the index of the dashboard to be shown) at the end of body. We don't immediately show the new iframe since it might take a while to load. (showNewFrameIfLoaded): Remove the current iframe and show the next iframe if the next dashboard has finished loading. We can't rely on DOMContentLoaded or load events because we use asynchronous XHR to load each chart's data. Instead, wait until some chart becomes available or fails to load and none of charts are still in progress to be shown. 2015-10-07 Ryosuke Niwa Allow custom revisions to be specified in A/B testing https://bugs.webkit.org/show_bug.cgi?id=149905 Reviewed by Chris Dumez. Allow custom revision number on each "repository" when creating a test group. * public/v2/app.css: (form .analysis-group [name=customValue]): Added. * public/v2/app.js: (App.AnalysisTaskController._createConfiguration): Added "Custom" as a revision option. Also added point labels such as (point 3) on "None" for when some points are missing revision info. (App.AnalysisTaskController._labelForPoints): Extracted from _createConfiguration. (App.AnalysisTaskController.actions.createTestGroup): Respect the custom revision number when custom revision option is selected. * public/v2/index.html: Added a text field for specifying a custom revision number. 2015-10-07 Ryosuke Niwa Make the site name configurable in perf dashboard https://bugs.webkit.org/show_bug.cgi?id=149894 Reviewed by Chris Dumez. Added "siteTitle" as a new configuration key to specify the site name. * public/include/db.php: (config): Now takes the default value as an argument. * public/include/manifest.php: (ManifestGenerator::generate): Include siteTitle in the manifest. * public/index.html: Update the title and the heading when the manifest is loaded. * public/v2/index.html: Use App.Manifest.siteTitle as the heading. document.title needs to be updated manually. * public/v2/manifest.js: (App.MetricSerializer.normalizePayload): Update document.title and App.Manifest.siteTitle. 2015-10-07 Ryosuke Niwa Perf dashboard doesn't show analysis tasks anchored at outliers https://bugs.webkit.org/show_bug.cgi?id=149870 Reviewed by Chris Dumez. The bug was caused by the computation of start and end times of analysis tasks being dependent on time series provided to the interactive chart component even though they are already filtered. Since the interactive chart component shouldn't be messing with the underlying data models, moved the code to compute start and end times to App.Pane, to where it belongs, and made the moved code use the unfiltered time series newly exposed on ChartData. Also fixed a bug in fetch-from-remote.php which resulted in Ember endlessly fetching same JSON files. * public/admin/fetch-from-remote.php: (.): Use the full request URI for HTTP requests and caching. Otherwise, we're going to mix up caches and Ember can start hanging browsers (took me three hours to debug this). * public/v2/app.js: (App.Pane._showOutlierChanged): Added. Resets chartData when showOutlier flag has been changed. (App.Pane.fetchAnalyticRanges): The old code wasn't filtering analysis tasks by platforms and metrics at all since it relied on the server-side REST API to do the filtering, which I haven't implemented yet. Filter the results manually instead. (App.Pane.ranges): Moved the logic to compute startTime and endTime here from InteractiveChartComponent. (App.PaneController.toggleShowOutlier): Now that App.Pane responds to showOutlier changes, we don't need to call a private method on it. (App.AnalysisTaskController._chartDataChanged): When end points are not found, try showing outliers. This will cause chartData to be modified so just exit early and wait for getting called again. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._rangesChanged): The code to compute start and end time has been moved to App.Pane.ranges. * public/v2/manifest.js: (App.Manifest._formatFetchedData): Added unfiltered time series as new properties as they are now used to compute the end points of analysis tasks when their end points are outliers. 2015-10-07 Ryosuke Niwa Unreviewed. Fix a typo in r190645. * public/include/db.php: 2015-10-06 Ryosuke Niwa V2 UI shouldn't sort dashboards lexicologically https://bugs.webkit.org/show_bug.cgi?id=149856 Reviewed by Chris Dumez. Don't sort the dashboards by name in App.Manifest. * public/v2/app.js: (App.IndexRoute.beforeModel): Don't transition to "undefined" (string) dashboard. * public/v2/manifest.js: (App.Manifest.._fetchedManifest): 2015-10-06 Ryosuke Niwa V2 UI fails to show the data for the very first point in charts https://bugs.webkit.org/show_bug.cgi?id=149857 Reviewed by Chris Dumez. The bug was caused by seriesBetweenPoints returning null for when point.seriesIndex is 0. Explicitly check the type of this property instead. * public/v2/data.js: (TimeSeries.prototype.seriesBetweenPoints): 2015-10-06 Ryosuke Niwa Perf dashboard should have the capability to test local UI with production data https://bugs.webkit.org/show_bug.cgi?id=149834 Reviewed by Chris Dumez. Added tools/run-with-remote-server.py which runs a local httpd server and pulls data from a remote server. * Install.md: Added the instruction on how to use the script. Also updated the remaining instructions for El Capitan. * config.json: Added remote server configurations. * public/admin/fetch-from-remote.php: Added. This script fetches JSON from the remote server specified in config.json and caches the results in the location specified as "cacheDirectory" in config.json. (main): (fetch_remote): * public/include/db.php: (config_path): Extracted from generate_data_file. (generate_data_file): * tools/remote-server-relay.conf: Added. Apache 2.4 configuration file for a local http server launched by run-with-remote-server.py. * tools/run-with-remote-server.py: Added. Launches Apache with the right set of directives. (main): (abspath_from_root): 2015-07-13 Ryosuke Niwa Fix a typo. * public/js/helper-classes.js: 2015-06-27 Ryosuke Niwa build-requests should use conform to JSON API format https://bugs.webkit.org/show_bug.cgi?id=146375 Reviewed by Stephanie Lewis. Instead of returning single dictionary that maps root set id to a dictionary of repository names to revisions, timestamps, simply return root sets and roots "rows" or "objects" as defined in JSON API (http://jsonapi.org/). This API change makes it easier to resolve the bug 146374 and matches what we do in /api/test-groups. Also add the support for /api/build-requests/?id= to fetch the build request with . This is useful for debugging purposes. * public/api/build-requests.php: (main): Added the support for $_GET['id']. Also return "rootSets" and "roots". (update_builds): Extracted from main. * public/include/build-requests-fetcher.php: (BuildRequestFetcher::fetch_request): Added. Used for /api/build-requests/?id=. (BuildRequestFetcher::results_internal): Always call fetch_roots_for_set_if_needed. (BuildRequestFetcher::fetch_roots_for_set_if_needed): Renamed from fetch_roots_for_set. Moved the logic to exit early when the root set had already been fetched here. * public/v2/analysis.js: (App.TestGroup._fetchTestResults): Fixed the bug that test groups without any successful results won't be shown. * tools/pull-os-versions.py: (main): (setup_auth): Moved to util.py * tools/sync-with-buildbot.py: (main): Replaced a bunch of perf dashboard related options by --server-config-json. (update_and_fetch_build_requests): No longer takes build_request_auth since that's now taken care of by setup_auth. (organize_root_sets_by_id_and_repository_names): Added. Builds the old rootsSets directory based on "roots" and "rootSets" dictionaries returned by /api/build-requests. (config_for_request): Fixed a bug that the script blows up when the build request is missing the repository specified in the configuration. This tolerance is necessary when a new repository dependency is added but we want to run A/B tests for old builds without the dependency. (fetch_json): No longer takes auth. * tools/util.py: (setup_auth): Moved from pull-os-versions.py to be shared with sync-with-buildbot.py. 2015-06-23 Ryosuke Niwa Build fix. A/B testing is broken when continuous builders report revisions out of order. * public/v2/app.js: (App.AnalysisTaskController.Ember.Controller.extend.): 2015-06-22 Ryosuke Niwa A/B testing results should be shown even if they were submitted to different platforms https://bugs.webkit.org/show_bug.cgi?id=146219 Reviewed by Andreas Kling. Fetch A/B testing results regardless of the platform to which results are submitted by providing the platform ID to which the results were submitted for each test group. * public/api/test-groups.php: (main): Include the platform id in the test groups. * public/v2/analysis.js: (App.TestGroup._fetchTestResults): Fetch results from the platform associated with the group. 2015-06-19 Csaba OsztrogonĂ¡c Remove unnecessary svn:executable flags https://bugs.webkit.org/show_bug.cgi?id=146107 Reviewed by Alexey Proskuryakov. * public/js/helper-classes.js: Removed property svn:executable. * public/js/jquery.flot.plugins.js: Removed property svn:executable. * public/v2/app.css: Removed property svn:executable. * public/v2/app.js: Removed property svn:executable. * public/v2/chart-pane.css: Removed property svn:executable. * public/v2/data.js: Removed property svn:executable. * public/v2/index.html: Removed property svn:executable. * public/v2/js/d3/LICENSE: Removed property svn:executable. * public/v2/js/d3/d3.js: Removed property svn:executable. * public/v2/js/d3/d3.min.js: Removed property svn:executable. * public/v2/js/ember-data.js: Removed property svn:executable. * public/v2/js/ember.js: Removed property svn:executable. * public/v2/js/handlebars.js: Removed property svn:executable. * public/v2/js/jquery.min.js: Removed property svn:executable. * public/v2/js/statistics.js: Removed property svn:executable. * public/v2/manifest.js: Removed property svn:executable. * public/v2/popup.js: Removed property svn:executable. 2015-06-17 Ryosuke Niwa Reading the list of analysis tasks is extremely slow https://bugs.webkit.org/show_bug.cgi?id=146086 Reviewed by Darin Adler. The bug was caused by Ember data requesting manifest.js hundreds of times. Fetch it ahead of time in each route instead. * public/v2/app.js: (App.AnalysisRoute.model): (App.AnalysisTaskRoute.model): 2015-06-17 Ryosuke Niwa Update ReadMe.md and Install.md per database changes https://bugs.webkit.org/show_bug.cgi?id=146076 Reviewed by Darin Adler. Updated. * Install.md: * ReadMe.md: 2015-06-17 Ryosuke Niwa Increase the popup dismissal time from 100ms to 500ms https://bugs.webkit.org/show_bug.cgi?id=146077 Rubber-stamped by Andreas Kling. * public/v2/popup.js: (App.PopupView.scheduleHiding): 2015-06-16 Ryosuke Niwa v2 UI should have buttons to breakdown a test https://bugs.webkit.org/show_bug.cgi?id=146010 Reviewed by Chris Dumez. Added buttons beneath each chart pane to add "alternative panes". By default, it shows every platform as well as "Breakdown" to add all subtests' metrics. Also removed the metric submenu from tests that had exactly one metric. When a test only measures Time for example, we make the test itself clickable instead of showing a submenu that only contains one item. * public/v2/app.js: (App.ChartsController.addAlternativePanes): Added. (App.TestProxyForPopup.children): Calls _updateChildren and returns this._children. (App.TestProxyForPopup.actionName): Added. (App.TestProxyForPopup.actionArgument): Added. (App.TestProxyForPopup._updateChildren): Extracted from children. Now also sets _actionName and _actionArgument in the case there was exactly one metric so that showing submenu is unnecessary. (App.PaneController.alternativePanes): Added. Returns the list of alternative panes. The platform list excludes ones that don't have this metric (e.g. iOS doesn't have desktop PLT results) as well as ones that are already present in the list of panes. * public/v2/chart-pane.css: Added CSS rules for alternative pane buttons beneath the chart panes. * public/v2/index.html: * public/v2/manifest.js: (App.Metric.childMetrics): Added. 2015-06-15 Ryosuke Niwa Build fix after r185574. * public/v2/app.js: (set get App.Pane.Ember.Object.extend.): 2015-06-15 Ryosuke Niwa Fix a typo. * tools/pull-os-versions.py: (main): 2015-06-15 Ryosuke Niwa Perf dashboard should be able to list iOS versions as well as OS X versions https://bugs.webkit.org/show_bug.cgi?id=146003 Reviewed by Stephanie Lewis. Generalized pull-osx.py so that it can run an arbitrary shell command to fetch OS versions based on information specified in config.json. * tools/pull-os-versions.py: Renamed from pull-osx.py. (main): Use available_builds_from_command when 'customCommands' is specified. (available_builds_from_command): Added. Executes a shell command to fetch a list of available builds. (fetch_available_builds): Now takes the repository name. 2015-06-15 Ryosuke Niwa Removed a superfluous console.log per Chris's comment. * public/v2/app.js: 2015-06-15 Ryosuke Niwa Analysis task should show all possible revisions for A/B testing https://bugs.webkit.org/show_bug.cgi?id=145996 Reviewed by Chris Dumez. * public/api/commits.php: (fetch_commits_between): When the time stamp is not available for commits, use revision numbers to find revisions between two ranges. This is necessary for OS X and iOS versions since they don't have a "commit time". * public/v2/app.js: (App.AnalysisTaskController.updateRootConfigurations): Fetch commits between two end points. (App.AnalysisTaskController._createConfiguration): Extracted from updateRootConfigurations. List the fetched list of commits if available. (App.AnalysisTaskController._serializeNumbersSkippingConsecutiveEntries): Added. Serializes an list of numbers intelligently. For example, [1, 2, 4, 5] turns into "1-2, 4-5". Without this, some lists of points shown in the A/B testing configurations become too long. * public/v2/commits-viewer.js: (App.CommitsViewerComponent.commitsChanged): * public/v2/data.js: (CommitLogs.fetchCommits): Renamed from fetchForTimeRange. 2015-06-13 Ryosuke Niwa Add a script to post new OS X builds to perf dashboard https://bugs.webkit.org/show_bug.cgi?id=145955 Reviewed by Darin Adler. Added a new script pull-osx.py and relaxed the restrictions on commits accepted by the dashboard API. * public/api/report-commits.php: (main): Allow more characters than [A-Za-z0-9] in revision. e.g. "10.10.3 14D136". Also allow commits without the author, commit time, and commit message as OS versions do not have those. * tools/pull-osx.py: Added. (main): Fetch the list of builds from a website and submit them per submissionSize with submissionInterval. Once all builds have been submitted, wait for a long time as specified by fetchInterval. (setup_auth): Sets up basic or digest auth to access the dashboard. (fetch_available_builds): Fetches and parses the XML document from an internal website. (textContent): A helper function to get the text content out of a XML node. (submit_commits): Submits commits to the perf dashboard. * tools/pull-svn.py: (fetch_commit): * tools/util.py: Extracted submit_commits and text_content from pull-svn.py to be reused in pull-osx.py. 2015-06-13 Ryosuke Niwa Perf dashboard's v2 UI shouldn't hide auto-detected outliers https://bugs.webkit.org/show_bug.cgi?id=145940 Reviewed by Darin Adler. Don't fallback to the default strategies for moving averages and envelope when one is not specified. Also deleted the code to mark points outside the envelop as outliers. * public/v2/app.js: 2015-06-12 Ryosuke Niwa Unreviewed build fix for merging platforms. * public/admin/platforms.php: 2015-06-09 Ryosuke Niwa Unreviewed build fix. Some builder names are really long. * init-database.sql: 2015-05-22 Ryosuke Niwa Show results and status before revisions for A/B testing results https://bugs.webkit.org/show_bug.cgi?id=145327 Reviewed by Chris Dumez. Place the results and the status columns before the columns for revisions. Also show the absolute difference as well as the relative difference between the averages of A and B. * public/v2/app.js: (App.TestGroupPane._populate): (App.TestGroupPane._computeStatisticalSignificance): * public/v2/index.html: 2015-05-20 Ryosuke Niwa Build fix after r184591. * public/v2/manifest.js: 2015-05-20 Ryosuke Niwa Build fix. Use POSIX timestamp instead of human readable string for the commit time. * public/include/build-requests-fetcher.php: 2015-05-20 Ryosuke Niwa UI to associate bugs with an analysis task is crappy https://bugs.webkit.org/show_bug.cgi?id=145198 Reviewed by Andreas Kling. Make the UI less crappy by linkifying bug numbers and adding an explicit button to disassociate a bug and a separate select view with a text field to associate a new bug instead of implicitly updating or deleting the existing record based on what the user had typed. * init-database.sql: Removed the constraint that each bug tracker should appear exactly once for a given analysis task since it's perfectly reasonable for a given task to be associated with multiple WebKit bugs. * public/privileged-api/associate-bug.php: (main): Only remove the bug specified by newly added bugToDelete instead of implicitly deleting one that matches the analysis task and the bug tracker when the bug number is falsey. * public/v2/analysis.js: (App.Bug.url): Added. (App.BugAdapter.deleteRecord): Added. Uses the privileged API to delete the record. * public/v2/app.css: * public/v2/app.js: (App.AnalysisTaskController.actions.addBug): Added. (App.AnalysisTaskController.actions.deleteBug): Added. (App.AnalysisTaskController.associateBug): Deleted. * public/v2/index.html: Updated the templates. * public/v2/manifest.js: (App.BugTracker.urlFromBugNumber): Added. 2015-05-20 Ryosuke Niwa A/B testing rootSets should provide commit times as well as revisions https://bugs.webkit.org/show_bug.cgi?id=145207 Reviewed by Andreas Kling. Some continuous build systems need the commit time as well as the revision number / hash so provide one in the root sets but maintain the backwards compatibility with buildbots that use revision number directly. * public/include/build-requests-fetcher.php: (BuildRequestsFetcher::fetch_roots_for_set): Made the revision info an associative array that contains the revision number as well as the commit time. * tools/sync-with-buildbot.py: (schedule_request): Removed "replacement" which was a superfluous copy of "roots". Use "revision" values when the JSON configuration refers to "root". This is necessary in buildbot instances that require WebKit revision to be specified on its own field instead of it being a JSON that contains "revision" and "time". 2015-05-19 Ryosuke Niwa Build fix. Don't fall into an infinite loop when value (renamed from bytes) is zero. * public/v2/manifest.js: (App.Manifest.Ember.Controller.extend.): (App.Manifest.Ember.Controller.extend): 2015-05-19 Ryosuke Niwa Don't show unit (bytes) separaetly from SI suffixes (K, M, etc...) https://bugs.webkit.org/show_bug.cgi?id=145181 Rubber-stamped by Chris Dumez. Show 'MB' in each y-axis label instead of showing 'bytes' separately and suffixing each label with just 'M' for clarity. This change also reduces the code complexity. * public/index.html: * public/v2/app.js: (App.AnalysisTaskController._chartDataChanged): (App.TestGroupPane._createConfigurationSummary): * public/v2/data.js: (RunsData.unitFromMetricName): Use 'B' instead of 'bytes' as the unit. * public/v2/interactive-chart.js: Removed the support for showing units separately. (App.InteractiveChartComponent._constructGraphIfPossible): (App.InteractiveChartComponent._relayoutDataAndAxes) * public/v2/manifest.js: (App.Manifest._makeFormatter): Renamed from _formatBytes. Support more SI suffixes such as micro and mili. Now takes the unit as the first argument. Adjust the base unit if it's 'ms'. (App.Manifest._formatFetchedData): Removed unit and formatWithUnit now that all all formatters would automatically include unit. 2015-05-18 Ryosuke Niwa REGRESSION: v2 UI reports a higher memory usage https://bugs.webkit.org/show_bug.cgi?id=145151 Reviewed by Chris Dumez. The bug was caused by v2 UI using 1000 to divide the number of bytes instead of by 1024 as done in v1. Fixed the bug by manually implementing the formatter as done in v1. * public/v2/manifest.js: (App.Manfiest._formatBytes): Added. (App.Manifest._formatFetchedData): Use _formatByte instead of format('s'). 2015-05-11 Ryosuke Niwa Unreviewed build fix. Add "Duration" as a time metric. * public/js/helper-classes.js: * public/v2/data.js: (RunsData.unitFromMetricName): 2015-05-06 Ryosuke Niwa Perf dashboard treats Speedometer and JetStream as smaller is better https://bugs.webkit.org/show_bug.cgi?id=144711 Reviewed by Chris Dumez. Added the support for "Score" metric. * public/js/helper-classes.js: (PerfTestRuns): * public/v2/data.js: (RunsData.unitFromMetricName): (RunsData.isSmallerBetter): 2015-04-23 Ryosuke Niwa Build fix after r183232. * public/include/json-header.php: 2015-04-23 Ryosuke Niwa Perf dashboard should automatically detect regressions https://bugs.webkit.org/show_bug.cgi?id=141443 Reviewed by Anders Carlsson. Added a node.js script detect-changes.js to detect potential regressions and progressions on the graphs tracked on v2 dashboards. * init-database.sql: Added analysis_strategies table and task_segmentation and task_test_range columns to analysis_tasks to keep the segmentation and test range selection strategies used to create an analysis task. * public/api/analysis-tasks.php: (format_task): Include task_segmentation and analysis_tasks in the results. * public/include/json-header.php: (remote_user_name): Returns null when the privileged API is authenticated as a slave instead of a CSRF prevention token. (should_authenticate_as_slave): Added. (ensure_privileged_api_data_and_token_or_slave): Added. Authenticate as a slave if slaveName and slavePassword are specified. Since detect-changes.js and other slaves are not susceptible to a CSRF attack, we don't need to check a CSRF token. * public/privileged-api/create-analysis-task.php: (main): Use ensure_privileged_api_data_and_token_or_slave to let detect-changes.js create new analysis task. Also add or find segmentation and test range selection strategies if specified. * public/privileged-api/create-test-group.php: (main): Use ensure_privileged_api_data_and_token_or_slave. * public/privileged-api/generate-csrf-token.php: * public/v2/app.js: (App.Pane._computeMovingAverageAndOutliers): _executeStrategy has been moved to Statistics. * public/v2/data.js: Export Measurement, RunsData, TimeSeries. Used in detect-changes.js. (Array.prototype.find): Added a polyfill to be used in node.js. (RunsData.fetchRuns): (RunsData.pathForFetchingRuns): Extracted from fetchRuns. Used in detect-changes.js. (RunsData.createRunsDataInResponse): Extracted from App.Manifest._formatFetchedData to use it in detect-changes.js. (RunsData.unitFromMetricName): Ditto. (RunsData.isSmallerBetter): Ditto. (RunsData.prototype._timeSeriesByTimeInternal): Added secondaryTime to sort points when commit times are identical. (TimeSeries): When commit times are identical, order points based on build time. This is needed for when we trigger two builds at two different OS versions with the same WebKit revision since OS versions don't change the commit times. (TimeSeries.prototype.findPointByIndex): Added. (TimeSeries.prototype.rawValues): Added. * public/v2/js/statistics.js: (Statistics.TestRangeSelectionStrategies.[0]): Use the 99% two-sided probability as claimed in the description of this strategy instead of the default probability. Also fixed a bug that debugging code was referring to non-existent variables. (Statistics.executeStrategy): Moved from App.Pane (app.js). * public/v2/manifest.js: (App.Manifest._formatFetchedData): Various code has been extracted into RunsData in data.js to be used in detect-changes.js. * tools/detect-changes.js: Added. The script fetches the manifest JSON, analyzes each graph in the v2 dashboards, and creates an analysis task for the latest regression or progression detected. It also schedules an A/B testing if possible and notifies another server; e.g. to send an email. (main): Loads the settings JSON specified in the argument. (fetchManifestAndAnalyzeData): The main loop that periodically wakes up to do the analysis. (mapInOrder): Executes callback sequentially (i.e. blocking) on each item in the array. (configurationsForTesting): Finds every (platform, metric) pair to analyze in the v2 dashbaords, and computes various values for when statistically significant changes are detected later. (analyzeConfiguration): Finds potential regressions and progression in the last X days where X is the specified maximum number of days using the specified strategies. Sort the resultant ranges in chronological order and create a new analysis task for the very last change we detected. We'll eventually create an analysis task for all detected changes since we're repeating the analysis in fetchManifestAndAnalyzeData after some time. (computeRangesForTesting): Fetch measured values and compute ranges to test using the specified segmentation and test range selection strategies. Once ranges are found, find overlapping analysis tasks as they need to be filtered out in analyzeConfiguration to avoid creating multiple analysis tasks for the same range (e.g. humans may create one before the script gets to do it). (createAnalysisTaskAndNotify): Create a new analysis task for the specified range, trigger an A/B testing if available, and notify another server with a HTML message as specified. (findStrategyByLabel): (changeTypeForRange): A change is a regression if values are getting larger in a smaller-is-better test or values are getting smaller in a larger-is-better test and vice versa. (summarizeRange): Create a human readable string that summarizes the change detected. e.g. "Potential 3.2% regression detected between 2015-04-20 12:00 and 17:00". (formatTimeRange): (getJSON): (postJSON): (postNotification): Recursively replaces $title and $massage in the specified JSON template. (instantiateNotificationTemplate): (fetchJSON): 2015-04-20 Ryosuke Niwa Perf dashboard should have UI to set status on analysis tasks https://bugs.webkit.org/show_bug.cgi?id=143977 Reviewed by Chris Dumez. Added the UI to set the result of an analysis task to 'progression', 'regression', 'unchanged', and 'inconclusive' as well as a boolean indicating whether creating the analysis task was the right thing to do or not. The latter will be a useful metric once we start automatically creating analysis tasks. * init-database.sql: Added two columns to analysis_tasks table. * public/api/analysis-tasks.php: Include the added columns in the JSON. * public/include/db.php: (Database::to_database_boolean): Added. * public/include/json-header.php: (require_match_one_of_values): Added. * public/privileged-api/update-analysis-task.php: Added. Updates 'result' and 'needed' values of an analysis task. (main): * public/v2/analysis.js: (App.AnalysisTask.result): Added. (App.AnalysisTask.needed): Added. We don't use DS.attr('boolean') here since that would coerce null into false and we want to differentiate null from false in order to differentiate the null-ness of the value. (App.AnalysisTask.saveStatus): Added. (App.AnalysisTask.statusLabel): Use 'result' as the label if it's set and all build requests have been processed. * public/v2/app.css: * public/v2/app.js: (App.AnalysisTaskController.analysisResultOptions): Added. (App.AnalysisTaskController.shouldNotHaveBeenCreated): Added. (App.AnalysisTaskController.needsFeedback): Added. Show the checkbox to indicate the analysis task should not have been created if 'no change' is selected. (App.AnalysisTaskController._updateChosenAnalysisResult): Added. (App.AnalysisTaskController.actions.saveStatus): Added. * public/v2/index.html: Extracted a partial template for updating the bug numbers. Also added the UI to update 'result' and 'needed' values of the analysis task. 2015-04-10 Ryosuke Niwa Unreviewed build fix. Updated config.json after recent changes. * config.json: 2015-04-10 Ryosuke Niwa Make the analysis page more useful https://bugs.webkit.org/show_bug.cgi?id=143617 Reviewed by Chris Dumez. * public/api/analysis-tasks.php: (fetch_and_push_bugs_to_tasks): Added total and finished numbers of build requests associated with the fetched analysis tasks as buildRequestCount and finishedBuildRequestCount respectively. * public/v2/analysis.js: (App.AnalysisTask.formattedCreatedAt): Added. (App.AnalysisTask._addLeadingZero): Added. (App.AnalysisTask.buildRequestCount): Added. (App.AnalysisTask.finishedBuildRequestCount): Added. (App.AnalysisTask.statusLabel): Added. Status total and finished numbers of build requests. (App.AnalysisTask.testGroups): (App.AnalysisTask.triggerable): (App.AnalysisTask.label): * public/v2/app.css: Tweaked style rules for the analysis page. * public/v2/app.js: (App.buildPopup): Sort the list of platforms by name. (App.AnalysisRoute.model): Sort the list of analysis tasks by the order they are created. (App.AnalysisTaskController._fetchedManifest): Added elementId to associate bug tracker names such as "Bugzilla" with the corresponding text field. * public/v2/index.html: Added a bunch of columns to the analysis page and also wrapped the table showing A/B testing results in a div with overflow: scroll so that it always leaves enough space for the accompanying graph. 2015-04-09 Ryosuke Niwa Perf dashboard should automatically select ranges for A/B testing https://bugs.webkit.org/show_bug.cgi?id=143580 Reviewed by Chris Dumez. Added a new statistics option for picking a A/B test range selection strategy. The selected ranges are shown in the graph using the same UI to show analysis tasks. * public/v2/app.js: (App.DashboardPaneProxyForPicker._platformOrMetricIdChanged): Updated the query parameters for charts page used by the dashboard since we've added a new parameter at the end. (App.Pane.ranges): Added. Merges ranges created for analysis tasks and A/B testing. (App.Pane.updateStatisticsTools): Clone and set the test range selection strategies. (App.Pane._cloneStrategy): Copy isSegmentation. (App.Pane._updateMovingAverageAndEnvelope): Set testRangeCandidates. (App.Pane._movingAverageOrEnvelopeStrategyDidChange): Update the charts when a new text range selection strategy is picked by the user. (App.Pane._computeMovingAverageAndOutliers): Compute the test ranges using the chosen strategy. Avoid going through isAnomalyArray when no anomaly detection strategy is enabled. Also changed the return value from the moving average time series to a dictionary that contains the moving average time series, a dictionary of anomalies, and an array of test ranges. (App.ChartsController._parsePaneList): Parse the test range selection strategy configuration. (App.ChartsController._serializePaneList): Ditto for serialization. (App.ChartsController._scheduleQueryStringUpdate): Update the URL hash when the user picks a new test range selection strategy. * public/v2/chart-pane.css: Fixed a typo as well as added a CSS rule for test ranges markers. * public/v2/index.html: Added UI for selecting a test range selection strategy. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._rangesChanged): Pass down "status" to be used as a class name. * public/v2/js/statistics.js: (Statistics.MovingAverageStrategies): Added isSegmentation to segmentation strategies. (Statistics.TestRangeSelectionStrategies): Added. 2015-04-08 Ryosuke Niwa The results of A/B testing should state statistical significance https://bugs.webkit.org/show_bug.cgi?id=143552 Reviewed by Chris Dumez. Added statistical comparisons between results for each configuration on analysis task page using Welch's t-test. The probability as well as t-statistics and the degrees of freedoms are reported. * public/v2/app.js: (App.TestGroupPane._populate): Report the list of statistical comparison between every pair of root configurations in the results. e.g. if we've got A, B, C configurations then compare A/B, A/C and B/C. (App.TestGroupPane._computeStatisticalSignificance): Compute the statistical significance using Welch's t-test. Report the probability by which two samples do not come from the same distribution. (App.TestGroupPane._createConfigurationSummary): Include the array of results for this configuration. Also renamed "items" to "requests" for clarity. * public/v2/index.html: Added the template for showing statistical comparisons. * public/v2/js/statistics.js: Renamed tDistributionQuantiles to tDistributionByOneSidedProbability for clarity. Also factored out the functions to convert from one-sided probability to two-sided probability and vice versa. (Statistics.supportedConfidenceIntervalProbabilities): (Statistics.confidenceIntervalDelta): (Statistics.probabilityRangeForWelchsT): Added. Computes the lower bound and the upper bound for the probability that two values are sampled from distinct distributions using Welch's t-test. (Statistics.computeWelchsT): This function now takes two-sided probability like all other functions. (.tDistributionByOneSidedProbability): Renamed from tDistributionQuantiles. (.oneSidedToTwoSidedProbability): Extracted. (.twoSidedToOneSidedProbability): Extracted. (Statistics.MovingAverageStrategies): Converted the one-sided probability to the two-sided probability now that computeWelchsT takes two-sided probability. 2015-04-08 Ryosuke Niwa Unreviewed fix after r182496 for when the cached runs JSON doesn't exist. * public/v2/app.js: (App.Pane._fetch): (App.Pane.refetchRuns): 2015-04-07 Ryosuke Niwa Perf dashboard should have a way of marking outliers https://bugs.webkit.org/show_bug.cgi?id=143466 Reviewed by Chris Dumez. Address kling's in-person comment to notify users when the new run status is saved in the database. * public/v2/app.js: (App.PaneController._selectedItemIsMarkedOutlierDidChange) * public/v2/chart-pane.css: Fixed a typo. 2015-04-07 Ryosuke Niwa Perf dashboard should have a way of marking outliers https://bugs.webkit.org/show_bug.cgi?id=143466 Reviewed by Chris Dumez. Added UI to mark a data point as an outlier as well as a button to toggle the visibility of outliers. Added a new privileged API /privileged-api/update-run-status to store this boolean flag. * init-database.sql: Added run_marked_outlier column to test_runs table. * public/admin/tests.php: * public/api/runs.php: (main): Only emit Cache-Control and Expires headers in v1 UI. (RunsGenerator::format_run): Emit markedOutlier. * public/include/admin-header.php: * public/include/db.php: (Database::is_true): Made it static. * public/include/manifest.php: (Manifest::platforms): * public/index.html: Call into /api/runs/ with ?cache=true. * public/privileged-api/update-run-status.php: Added. (main): Updates the newly added column in test_runs table. * public/v2/app.js: (App.Pane._fetch): (App.Pane.refetchRuns): Extracted from App.Pane._fetch. (App.Pane._didFetchRuns): Renamed from _updateChartData. (App.Pane._setNewChartData): Added. Pick the right time series based based on the value of showOutlier. Cloning chartData is necessary when toggling the outlier visibility or using statistics tools because the interactive chart component only observes changes to chartData and not individual properties of it. (App.Pane._highlightPointsMarkedAsOutlier): Added. Highlight points marked as outliers. (App.Pane._movingAverageOrEnvelopeStrategyDidChange): Call to _setNewChartData replaced the code to clone chartData here. (App.PaneController.actions.toggleShowOutlier): Toggle the visibility of points marked as outliers by invoking App.Pane._setNewChartData. (App.PaneController._detailsChanged): Don't hide the analysis pane when details changed since keep opening the pane for marking points as outliers would be annoying. (App.PaneController._updateCanAnalyze): Update 'cannotMarkOutlier' as well as 'cannotAnalyze'. (App.PaneController.selectedMeasurement): Added. (App.PaneController.showOutlierTitle): Added. (App.PaneController._selectedItemIsMarkedOutlierDidChange): Added. Call out to setMarkedOutlier to mark the selected point as an outlier via the newly added privileged API. * public/v2/chart-pane.css: Updated styles. * public/v2/data.js: (PrivilegedAPI._post): Report the semantic errors. (Measurement.prototype.markedOutlier): Added. (Measurement.prototype.setMarkedOutlier): Added. Uses PrivilegedAPI to update the database. (RunsData.prototype.timeSeriesByCommitTime): Added a new argument, includeOutliers, to indicate whether the time series should include measurements marked as outliers or not. (RunsData.prototype.timeSeriesByBuildTime): Ditto. (RunsData.prototype._timeSeriesByTimeInternal): Extracted from timeSeriesByCommitTime and timeSeriesByBuildTime to share code. Now ignores measurements marked as outliers if needed. * public/v2/index.html: Added an icon for showing and hiding outliers. Also added a checkbox to mark individual points as outliers. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._selectClosestPointToMouseAsCurrentItem): Re-enable the distance heuristics that takes vertical closeness into account. This heuristics is more useful when marking some points as outliers. This heuristics was disabled because the behavior was unpredictable but with the arrow key navigation support, this is no longer an issue. * public/v2/manifest.js: (App.Manifest._formatFetchedData): Added showOutlier to the chart data. This function dynamically updates the time series in this chart data in order to include or exclude outliers. 2015-04-03 Ryosuke Niwa Perf dashboard should be able to trigger A/B testing jobs for iOS https://bugs.webkit.org/show_bug.cgi?id=143398 Reviewed by Chris Dumez. Fix various bugs in the perf dashboard so that it can schedule A/B testing jobs for iOS. Also generalized sync-with-buildbot.py slightly to meet the requirements of iOS builders. * public/api/triggerables.php: (main): Avoid spitting a warning when $id_to_triggerable doesn't contain the triggerable. * public/v2/analysis.js: (App.AnalysisTask.triggerable): Log an error when failed to fetch triggerables for debugging purposes. * public/v2/app.js: (App.AnalysisTaskController.updateRootConfigurations): Show 'None' when a revision is missing from some of the data points. This will happen when we modify the list of projects we build for iOS. (App.AnalysisTaskController.actions.createTestGroup): Gracefully fail by showing alerts when an user attempts to create an invalid test group; when there is already another test group of the same or when only either configuration specifies the revision for some repository. (App.AnalysisTaskController._updateRootsBySelectedPoints): Fixed a typo: sets[i] -> set. * public/v2/index.html: Don't show the form to create a new test group if it's not available. * tools/sync-with-buildbot.py: (find_request_updates): (schedule_request): iOS builders take a JSON that contains the list of roots. Generate this JSON when a dictionary of the form {rootsExcluding: ["WebKit"]} is specified. Also replaced the way we refer to a revision from $-based text replacements to an explicit dictionary of the form {root: "WebKit"}. (request_id_from_build): Don't hard code the parameter name here. Retrieve the name from the config. 2015-04-03 Ryosuke Niwa Add time series segmentation algorithms as moving averages https://bugs.webkit.org/show_bug.cgi?id=143362 Reviewed by Chris Dumez. This patch implements two preliminary time series segmentation algorithms as moving averages. Recursive t-test: Compute Welch's t-statistic at each point in a given segment of the time series. If Welch's t-test implicates a statistically significance difference, then split the segment into two sub segments with the maximum t-statistic (i.e. the point at which if split would yield the highest probability that two segments do not share the same "underlying" mean in classical / frequentist sense). We repeat this process recursively. See [1] for the evaluation of this particular algorithm. Schwarz criterion: Use Schwarz or Bayesian information criterion to heuristically find the optimal segmentation. Intuitively, the problem of finding the best segmentation comes down to minimizing the residual sum of squares in each segment as in linear regressions. That is, for a given segment with values y_1 through y_n with mean y_avg, we want to minimize the sum of (y_i - y_avg)^2 over i = 1 through i = n. However, we also don't want to split every data point into a separate segment so we need to account the "cost" of introducing new segments. We use a cost function that's loosely based on two models discussed in [2] for simplicity. We will tune this cost function further in the future. The problem of finding the best segmentation then reduces to a search problem. Unfortunately, our problem space is exponential with respect to the size of the time series since we could split at each data point. We workaround this problem by first splitting the time series into a manageable smaller grids, and only considering segmentation of a fixed size (i.e. the number of segments is constant). Since time series tend to contain a lot more data points than segments, this strategy finds the optimal solution without exploring much of the problem space. Finding the optimal segmentation of a fixed size is, itself, another search problem that is equivalent to finding the shortest path of a fixed length in DAG. Here, we use dynamic programming with a matrix of size n by n where n is the length of the time series (grid). Each entry in this matrix at (i, k) stores the minimum cost of segmenting data points 1 through i using k segments. We start our search at i = 1. Clearly C(1, 0) = 0 (note the actual code uses 0-based index). In i-th iteration, we compute the cost S(i, j) of each segment starting at i and ending at another point j after i and update C(j, k + 1) by min( C(j, k + 1), C(i, k) + S(i, j) ) for all values of j above i. [1] Kensuke Fukuda, H. Eugene Stanley, and Luis A. Nunes Amaral, "Heuristic segmentation of a nonstationary time series", Physical Review E 69, 021108 (2004) [2] Marc Lavielle, Gilles Teyssi`ere, "Detection of Multiple Change–Points in Multivariate Time Series" Lithuanian Mathematical Journal, vol 46, 2006 * public/v2/index.html: Show the optional description for the chosen moving average strategy. * public/v2/js/statistics.js: (Statistics.testWelchsT): (Statistics.computeWelchsT): Extracted from testWelchsT. Generalized to take the offset and the length of each value array between which Welch's t-statistic is computed. This generalization helps the Schwarz criterion segmentation algorithm avoid splitting values array O(n^2) times. (.sampleMeanAndVarianceForValues): Ditto for the generalization. (.recursivelySplitIntoTwoSegmentsAtMaxTIfSignificantlyDifferent): Added. Implements recursive t-test. (.splitIntoSegmentsUntilGoodEnough): Added. Implements Schwarz criterion. (.findOptimalSegmentation): Added. Implements the algorithm to find the optimal segmentation of a fixed segment count. (.SampleVarianceUpperTriangularMatrix): Added. Stores S(i, j) used by findOptimalSegmentation. (.SampleVarianceUpperTriangularMatrix.prototype.costBetween): Added. 2015-04-03 Ryosuke Niwa REGRESSION: Perf dashboard sometimes fails to update zooming level https://bugs.webkit.org/show_bug.cgi?id=143359 Reviewed by Darin Adler. The bug was caused by various bugs that ended up in an exception. * public/v2/app.js: (App.Pane._handleFetchErrors): Removed superfluous console.log. (App.Pane.computeStatus): Fixed the bug in r182185 that previousPoint could be null. (App.PaneController.actions.zoomed): Update the overview when the main chart triggered a zoom. * public/v2/index.html: Replaced all instances of href="#" by href="javascript:false" to avoid navigating to # when Ember.js fails to attach event listeners on time. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._updateDimensionsIfNeeded): Avoid using a negative width or height when the containing element's size is 0. (App.InteractiveChartComponent._updateBrush): Ditto. 2015-04-02 Ryosuke Niwa Perf dashboard should have UI to test out anomaly detection strategies https://bugs.webkit.org/show_bug.cgi?id=143290 Reviewed by Benjamin Poulain. Added the UI to select anomaly detection strategies. The detected anomalies are highlighted in the graph. Implemented the Western Electric Rules 1 through 4 in http://en.wikipedia.org/wiki/Western_Electric_rules as well as Welch's t-test that compares the last five points to the prior twenty points. The latter is what Mozilla uses (or at least did in the past) to detect performance regressions on their performance tests although they compare medians instead of means. All of these strategies don't quite work for us since our data points are too noisy but this is a good start. * public/v2/app.js: (App.Pane.updateStatisticsTools): Clone anomaly detection strategies. (App.Pane._updateMovingAverageAndEnvelope): Highlight anomalies detected by the enabled strategies. (App.Pane._movingAverageOrEnvelopeStrategyDidChange): Observe changes to anomaly detection strategies. (App.Pane._computeMovingAverageAndOutliers): Detect anomalies by each strategy and aggregate results. Only report the first data point when multiple consecutive data points are detected as anomalies. * public/v2/chart-pane.css: Updated styles. * public/v2/index.html: Added the pane for selecting anomaly detection strategies. * public/v2/js/statistics.js: (Statistics.testWelchsT): Added. Implements Welch's t-test. (.sampleMeanAndVarianceForValues): Added. (.createWesternElectricRule): Added. (.countValuesOnSameSide): Added. (Statistics.AnomalyDetectionStrategy): Added. 2015-03-31 Ryosuke Niwa REGRESSION: Searching commits can highlight wrong data points https://bugs.webkit.org/show_bug.cgi?id=143272 Reviewed by Antti Koivisto. The bug was caused by /api/commits returning commit times with millisecond precision whereas /api/runs return commit times with only second precision. This resulted in the frontend code to match a commit with the data point that included the next commit when the millisecond component of commit's timestamp wasn't identically 0. This discrepancy was caused by the fact PHP's strtotime only ignores milliseconds and /api/commits was returning timestamp as string instead of parsing via Database::to_js_time as done in /api/runs so miliseconds component was only preserved in /api/commits. Fixed the bug by always using Database::to_js_time to return commit time. Also fixed to_js_time so that it returns time in milisecond precision. * public/api/commits.php: (fetch_commits_between): Use Database::to_js_time for format commit times. (format_commit): Ditto. * public/include/db.php: (Database::to_js_time): Parse and append millisecond component. Ignore sub-milliseconds for simplicity. * public/v2/data.js: (CommitLogs.fetchForTimeRange): The commit time is now an integer so don't call "replace" on it. 2015-03-31 Ryosuke Niwa Perf dashboard should show relative change in values https://bugs.webkit.org/show_bug.cgi?id=143252 Reviewed by Antti Koivisto. When a range of values are selected, show the percentage difference between the start and the end in addition to the absolute value difference. When a single point is selected, show the relative difference with respect to the previous point. Use two significant figures and always show plus sign when the difference is positive. * public/v2/app.js: Compute and format the relative difference. * public/v2/chart-pane.css: Don't let commits view shrink itself when they're all collapsed. * public/v2/index.html: Show the relative difference. 2015-03-31 Ryosuke Niwa REGRESSION(r180000): Changing moving average or enveloping strategy doesn't update the graph https://bugs.webkit.org/show_bug.cgi?id=143254 Reviewed by Antti Koivisto. The bug was caused by App.Pane no longer replacing 'chartData' property when updating the moving average or the enveloping values. Fixed the bug by creating a new chartData object when the strategy is changed so that the interactive chart component will observe a change to 'chartData'. * public/v2/app.js: (App.Pane._movingAverageOrEnvelopeStrategyDidChange): Added. 2015-03-19 Ryosuke Niwa Unreviewed build fixes. * public/include/manifest.php: (Manifest::generate): These should be {} instead of [] when they're empty. * public/v2/data.js: (Measurement.prototype.formattedRevisions): Don't assume previousRevisions[repositoryId] exits. * public/v2/manifest.js: (App.Metric.fullName): Fixed the typo. * tests/admin-regenerate-manifest.js: Fixed the test. 2015-02-20 Ryosuke Niwa Commit the erroneously reverted change. * public/api/runs.php: (RunsGenerator::results): 2015-02-20 Ryosuke Niwa Loading the perf dashboard takes multiple seconds https://bugs.webkit.org/show_bug.cgi?id=141860 Reviewed by Andreas Kling. This patch introduces the caches of JSON files returned by /api/ in /data/ directory. It also records the last time test_runs rows associated with the requested platforms and metrics are inserted, updated, or removed in the caches as well as the manifest JSON files ("last modified time"). Because the manifest is regenerated each time a new test result is reported, the front end can compare last modified time in the manifest file with that in a /api/runs JSON cache to detect the stale-ness. More concretely, the front end first optimistically fetches the JSON in /data/. If the cache doesn't exit or the last modified time in the cache doesn't match with that in the manifest file, it would fetch it again via /api/runs. In the case the cache did exist, we render the charts based on the cache meanwhile. This dramatically reduces the perceived latency for the page load since charts are drawn immediately using the cache and we would only re-render the charts as new up-to-date JSON comes in. This patch also changes the format of runs JSONs by pushing the exiting properties into 'configurations' and adding 'lastModified' and 'elapsedTime' at the top level. * init-database.sql: Added config_runs_last_modified to test_configurations table as well as a trigger to auto-update this column upon changes to test_runs table. * public/admin/test-configurations.php: (add_run): Regenerate the manifest file to invalidate the /api/runs JSON cache. (delete_run): Ditto. * public/api/runs.php: (main): Fetch all columns of test_configurations table including config_runs_last_modified. Also generate the cache in /data/ directory. (RunsGenerator::__construct): Compute the last modified time for this (platform, metric) pair. (RunsGenerator::results): Put the old content in 'configurations' property and include 'lastModified' and 'elapsedTime' properties. 'elapsedTime' is added for debugging purposes. (RunsGenerator::add_runs): (RunsGenerator::parse_revisions_array): * public/include/db.php: (CONFIG_DIR): Added. (generate_data_file): Added based on ManifestGenerator::store. (Database::to_js_time): Extracted from RunsGenerator::add_runs to share code. * public/include/json-header.php: (echo_success): Renamed from success_json. Return the serialized JSON instead of echo'ing it so that we can generate caches in /api/runs/. (exit_with_success): * public/include/manifest.php: (ManifestGenerator::generate): Added 'elapsedTime' property for the time taken to generate the manifest. It seems like we're generating it in 200-300ms for now so that's good. (ManifestGenerator::store): Uses generate_data_file. (ManifestGenerator::platforms): Added 'lastModified' array to each platform entry. This array contains the last modified time for each (platform, metric) pair. * public/index.html: (fetchTest): Updated per the format change in runs JSON. * public/v2/app.js: (App.Pane._fetch): Fetch the cached JSON first. Refetch the uncached version if instructed as such. (App.Pane._updateChartData): Extracted from App.Pane._fetch. (App.Pane._handleFetchErrors): Ditto. * public/v2/data.js: (RunsData.fetchRuns): Takes the fourth argument indicating whether we should fetch the cached version or not. The cached JSON is located in /data/ with the same filename. When fetching a cached JSON results in 404, fulfill the promise with null as the result instead of rejecting it. The only client of this function which sets useCache to true is App.Manifest.fetchRunsWithPlatformAndMetric, and it handles this special case. * public/v2/manifest.js: (App.DateArrayTransform): Added. Handles the array of last modified dates in platform objects. (App.Platform.lastModifiedTimeForMetric): Added. Returns the last modified date in the manifest JSON. (App.Manifest.fetchRunsWithPlatformAndMetric): Takes "useCache" like RunsData.fetchRuns. Set shouldRefetch to true if response is null (the cache didn't exit) or the cache is out-of-date. (App.Manifest._formatFetchedData): Extracted from App.Manifest.fetchRunsWithPlatformAndMetric. * run-tests.js: (initializeDatabase): Avoid splitting function definitions in the middle. * tests/api-report.js: Added tests to verify that reporting new test results updates the last modified time in test_configurations. 2015-02-20 Ryosuke Niwa REGRESSION(r180333): Analysis tasks can't be associated with bugs https://bugs.webkit.org/show_bug.cgi?id=141858 Reviewed by Andreas Kling. Added back the erroneously removed table to associate bugs. Also moved "details-table-container" div outside of the chart-details partial template as it needs to wrap associate bugs in analysis task pages. * public/v2/chart-pane.css: * public/v2/index.html: 2015-02-20 Ryosuke Niwa Selecting revisions for A/B testing is hard https://bugs.webkit.org/show_bug.cgi?id=141824 Reviewed by Andreas Kling. Update the revisions used in A/B testing based on the selection in the overview chart. This allows users to intuitively select revisions based on points shown in the chart. Removed the old select elements used to select A/B testing points manually. Also renamed 'testSets' to 'configurations', 'roots' to 'rootConfigurations', and 'revisions' in each root's sets to 'options' for clarity. * public/v2/app.css: Reorganized style rules. * public/v2/app.js: (App.AnalysisTaskController): (App.AnalysisTaskController._taskUpdated): Merged updateTestGroupPanes. (App.AnalysisTaskController._chartDataChanged): Renamed from paneDomain. It's now an observer instead of a property, which sets 'overviewDomain' property as well as other properties. (App.AnalysisTaskController.updateRootConfigurations): Renamed from updateRoots. (App.AnalysisTaskController._updateRootsBySelectedPoints): Added. Select roots based on the selected points in the overview chart. * public/v2/chart-pane.css: Added arrows next to the configuration names (e.g. 'A') to indicate whether individual build requests / test results are shown or not. * public/v2/index.html: Removed the select element per configuration column. Also moved the select element for the number of runs as it doesn't belong in the same table as the one that lists repositories and roots. 2015-02-20 Ryosuke Niwa Unreviewed test fixes after r179037, r179591, and r179763. * tests/admin-regenerate-manifest.js: * tests/admin-reprocess-report.js: 2015-02-19 Ryosuke Niwa Relationship between A/B testing results are unclear https://bugs.webkit.org/show_bug.cgi?id=141810 Reviewed by Andreas Kling. Show a "reference chart" indicating which two points have been tested in each test group pane. Now the chart shown at the top of an analysis task page is called the "overview pane", and we use the pane and the domain used in this chart to show charts in each test group. Also renamed an array of revisions used in the A/B test results tables from 'revisions' to 'revisionList'. * public/v2/analysis.js: (App.TestGroup._fetchTestResults): Renamed from _fetchChartData. Set 'testResults' instead of 'chartData' since this is the results of A/B testing results, not the data for charts shown next to them. * public/v2/app.css: Added CSS rules for reference charts. * public/v2/app.js: (App.AnalysisTaskController.paneDomain): Set 'overviewPane' and 'overviewDomain' on each test group pane. (App.TestGroupPane._populate): Updated per 'chartData' to 'testResults' rename. (App.TestGroupPane._updateReferenceChart): Get the chart data via the overview pane and find points that identically matches root sets. If one of configuration used a set of revisions for which no measurement was made in the original chart, don't show the reference chart as that would be misleading / confusing. (App.TestGroupPane._computeRepositoryList): Updated per 'chartData' to 'testResults' rename. (App.TestGroupPane._createConfigurationSummary): Ditto. Also renamed 'revisions' to 'revisionList'. In addition, renamed 'buildNumber' to 'buildLabel' and prefixed it with "Build ". * public/v2/data.js: (Measurement.prototype.revisionForRepository): Added. (Measurement.prototype.commitTimeForRepository): Cleanup. (TimeSeries.prototype.findPointByRevisions): Added. Finds a point based on a set of revisions. * public/v2/index.html: Added the reference chart. Streamlined the status label for each build request by including the build number in the title attribute instead of in the markup. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._updateDomain): Fixed a typo introduced as a consequence of r179913. (App.InteractiveChartComponent._computeYAxisDomain): Expand the y-axis to show the highlighted points. (App.InteractiveChartComponent._highlightedItemsChanged): Adjust the y-axis as needed. 2015-02-18 Ryosuke Niwa Analysis task pages are unusable https://bugs.webkit.org/show_bug.cgi?id=141786 Reviewed by Andreas Kling. This patch makes following improvements to analysis task pages: 1. Making the main chart interactive. This change required the use of App.Pane as well as moving the code to compute the data for the details pane from PaneController. 2. Moving the form to add a new test group to the top of test groups instead of the bottom of them. 3. Grouping the build requests in each test group by root sets instead of the order by which they were ran. This change required the creation of App.TestGroupPane as well as its methods. 4. Show a box plot for each root set configuration as well as each build request. This change required App.BoxPlotComponent. 5. Show revisions of each repository (e.g. WebKit) for each root set and build request. * public/api/build-requests.php: (main): Update per the rename of BuildRequestsFetcher::root_sets to BuildRequestsFetcher::root_sets_by_id. * public/api/test-groups.php: (main): Include root sets and roots in the response. (format_test_group): * public/include/build-requests-fetcher.php: (BuildRequestsFetcher::root_sets_by_id): Renamed from root_sets. (BuildRequestsFetcher::root_sets): Added. (BuildRequestsFetcher::roots): Added. (BuildRequestsFetcher::fetch_roots_for_set): Takes a boolean argument $resolve_ids. This flag is only set to true in /api/build-requests/ (as done prior to this patch) to use repository names as identifiers since tools/sync-with-buildbot.py can't convert repository names to their ids. * public/v2/analysis.js: (App.Root): Added. (App.RootSet): Added. (App.RootSet.revisionForRepository): Added. (App.TestGroup.rootSets): Deleted the code to compute root set ids from build requests now that the JSON response at /api/test-groups will include them. (App.BuildRequest): Ditto. Also deleted 'configLetter' property, which has been moved to a proxy created by _createConfigurationSummary. (App.BuildRequest.statusLabel): Use 'Completed' as the human readable label for 'completed' status. (App.BuildRequest.aggregateStatuses): Added. Generates a human readable status for a set of build requests. * public/v2/app.css: Updated style rules for analysis task pages. * public/v2/app.js: (App.Pane): This class is now used in analysis task pages to make the main chart interactive. (App.Pane._updateDetails): Moved from App.PaneController. (App.PaneController._updateCanAnalyze): Updated the code per the move of selectedPoints. (App.AnalysisTaskController): Added 'details'. (App.AnalysisTaskController._taskUpdated): (App.AnalysisTaskController.paneDomain):Renamed from _fetchedRuns. (App.AnalysisTaskController.updateTestGroupPanes): Added. Creates App.TestGroupPane for each test group. (App.AnalysisTaskController.actions.toggleShowRequestList): Added. (App.TestGroupPane): Added. (App.TestGroupPane._populate): Added. Group build requests by root sets and create a summary for each group. (App.TestGroupPane._computeRepositoryList): Added. Returns a sorted list of repositories which is the union of all repositories appearing in root sets and builds associated with A/B testing results. (App.TestGroupPane._groupRequestsByConfigurations): Added. Groups build requests by root sets. (App.TestGroupPane._createConfigurationSummary): Added. Creates a summary for a group of build requests that use the same root set. We start by wrapping "raw" build requests in a proxy with formatted values, build numbers, etc... obtained from the fetched chart data. The list of revisions shown in the group summary is a union of revisions in the root set and the first build request in the group. We null-out revision info for a build request if it is identical to the one in the summary. The range of values is expanded as needed by the values in the group as well as 95% percentile confidence interval. (App.BoxPlotComponent): Added. Controls a box plot shown for each test group summary and build request. (App.BoxPlotComponent.didInsertElement): Added. Inserts a SVG element as well as two indicator rects to show the mean and the confidence interval. (App.BoxPlotComponent._updateBars): Added. Updates the dimensions of the indicator rects. (App.BoxPlotComponent.valueChanged): Added. Computes the relative dimensions of the indicator rects and calls _updateBars to update the rects. * public/v2/chart-pane.css: Added some style rules to be used in the details pane in analysis task pages. * public/v2/data.js: (Measurement.prototype.formattedRevisions): (Measurement.formatRevisionRange): Renamed from Measurement.prototype._formatRevisionRange so that it can be called in _createConfigurationSummary. * public/v2/index.html: Updated the templates for analysis task pages. Moved the form to create a new test group above all test groups, and replaced the list of data points by "details" pane used in the charts page. Also made the fetching of chartData no longer block showing of test groups. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._updateDomain): Added an early exit to fix a newly revealed race condition. (App.InteractiveChartComponent._domainChanged): Ditto. (App.InteractiveChartComponent._updateSelectionToolbar): Made it respect 'zoomable' boolean property. * public/v2/js/statistics.js: (Statistics.min): Added. (Statistics.max): Added. * public/v2/manifest.js: (App.Manifest.fetchRunsWithPlatformAndMetric): Added formatWithDeltaAndUnit to be used in _createConfigurationSummary. 2015-02-14 Ryosuke Niwa Build URL on new perf dashboard doesn't resolve $builderName https://bugs.webkit.org/show_bug.cgi?id=141583 Reviewed by Darin Adler. Support $builderName in the build URL template. * public/js/helper-classes.js: (TestBuild.buildUrl): Replaced $builderName with the builder name. * public/v2/manifest.js: (App.Metric.fullName): Fixed the typo. We need &ni, not &in. (App.BuilderurlFromBuildNumber): Replaced $builderName with the builder name. 2015-02-13 Ryosuke Niwa Unreviewed build fix after r179591. * public/api/commits.php: 2015-02-13 Ryosuke Niwa The status of a A/B testing request always eventually becomes "Failed" https://bugs.webkit.org/show_bug.cgi?id=141523 Reviewed by Andreas Kling. The bug was caused by /api/build-requests always setting the status of a build request to 'failed' when 'failedIfNotCompleted' was sent by the buildbot sync'er. Fixed the bug by only setting the status to 'failed' if it wasn't set to 'completed'. * public/api/build-requests.php: (main): 2015-02-13 Csaba OsztrogonĂ¡c Unreviewed, remove empty directories. * public/data: Removed. 2015-02-12 Ryosuke Niwa Perf dashboard should show the results of A/B testing https://bugs.webkit.org/show_bug.cgi?id=141500 Reviewed by Chris Dumez. Added the support for fetching test_runs for a specific test group in /api/runs/, and used it in the analysis task page to fetch results for each test group. Merged App.createChartData into App.Manifest.fetchRunsWithPlatformAndMetric so that App.BuildRequest can use the formatter. * public/api/runs.php: (fetch_runs_for_config_and_test_group): Added. (fetch_runs_for_config): Just return the fetched rows since main will format them with RunsGenerator. (main): Use fetch_runs_for_config_and_test_group to fetch rows when a test group id is specified. Also use RunsGenerator to format results. (RunsGenerator): Added. (RunsGenerator::__construct): Added. (RunsGenerator::add_runs): Added. (RunsGenerator::format_run): Moved. (RunsGenerator::parse_revisions_array): Moved. * public/v2/analysis.js: (App.TestGroup): Fixed a typo. The property on a test group that refers to an analysis task is "task". (App.TestGroup._fetchChartData): Added. Fetches all A/B testing results for this group. (App.BuildRequest.configLetter): Renamed from config since this returns a letter that identifies the configuration associated with this build request such as "A" and "B". (App.BuildRequest.statusLabel): Added the missing label for failed build requests. (App.BuildRequest.url): Added. Returns the URL associated with this build request. (App.BuildRequest._meanFetched): Added. Retrieve the mean and the build number for this request via _fetchChartData. * public/v2/app.js: (App.Pane._fetch): Set chartData directly here. (App.Pane._updateMovingAverageAndEnvelope): Renamed from _computeChartData. No longer sets chartData now that it's done in App.Pane._fetch. (App.AnalysisTaskController._fetchedRuns): Updated per createChartData merge. * public/v2/data.js: (Measurement.prototype.buildId): Added. (TimeSeries.prototype.findPointByBuild): Added. * public/v2/index.html: Fixed a bug that build status URL was broken. We can't use link-to helper since url is not an Ember routed path. * public/v2/manifest.js: (App.Manifest.fetchRunsWithPlatformAndMetric): Takes testGroupId as the third argument. Merged App.createChartData here so that App.BuildRequest can use the formatter 2015-02-12 Ryosuke Niwa v2 UI should adjust the number of ticks on dashboards based on screen size https://bugs.webkit.org/show_bug.cgi?id=141502 Reviewed by Chris Dumez. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._updateDimensionsIfNeeded): Compute the number of ticks based on the content size. 2015-02-11 Ryosuke Niwa New perf dashboard shows too much space around interesting data points https://bugs.webkit.org/show_bug.cgi?id=141487 Reviewed by Chris Dumez. Revise the y-axis range adjustment algorithm in r179913. Instead of showing the entire moving average, show the current time series excluding points in the series outside the moving average envelope. * public/v2/app.js: (App.Pane._computeChartData): Don't deal with missing moving average or enveloping strategy here. (App.Pane._computeMovingAverageAndOutliers): Set isOutliner to true on all data points in the current time series if the point lies outside the moving average envelope. Don't expose the moving average or the envelope computed for this purpose if they're not set by the user. * public/v2/data.js: (TimeSeries.prototype.minMaxForTimeRange): Takes a boolean argument, ignoreOutlier. When the flag is set to true, min/max computation will ignore any point in the series with non-falsy "isOutliner" property. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._constructGraphIfPossible): Unsupport hideMovingAverage and hideEnvelope. (App.InteractiveChartComponent._computeYAxisDomain): Removed the commented out code. Also moved the code to deal with showFullYAxis here. (App.InteractiveChartComponent._minMaxForAllTimeSeries): Rewrote the code. Takes ignoreOutliners as an argument instead of directly inspecting showFullYAxis. 2015-02-10 Ryosuke Niwa New perf dashboard shouldn't always show outliners https://bugs.webkit.org/show_bug.cgi?id=141445 Reviewed by Chris Dumez. Use the simple moving average with an average difference envelope to compute the y-axis range to show to avoid expanding it spuriously to show one off outlier. * public/v2/app.js: (App.Pane): Don't show the full y-axis range by default. (App.Pane._computeChartData): Use the first strategies for the moving average and the enveloping if one is not specified by the user but without showing them in the charts. (App.Pane._computeMovingAverage): Takes moving average and enveloping strategies as arguments instead of retrieving via chosenMovingAverageStrategy and chosenEnvelopingStrategy. (App.ChartsController._parsePaneList): Added showFullYAxis as a query string argument to each pane. (App.ChartsController._serializePaneList): Ditto. * public/v2/chart-pane.css: Added a CSS rule for when y-axis is clickable. * public/v2/index.html: Pass in showFullYAxis as an argument to the main interactive chart. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._constructGraphIfPossible): Add an event listener on y-axis labels when the chart is interactive so that toggle showFullYAxis. Also hide the moving average and/or the envelope if they are not specified by the user (i.e. only used to adjust y-axis range). (App.InteractiveChartComponent._updateDomain): Don't exit early if y-axis domains are different even if x-axis domain remained the same. Without this change, the charts would never redraw. (App.InteractiveChartComponent._minMaxForAllTimeSeries): Use the moving average instead of the current time series to compute the y-axis range if showFullYAxis is false. When showFullYAxis is true, expand y-axis all the way down to 0 or the minimum value in the current time series whichever is smaller. * public/v2/js/statistics.js: (Statistics.MovingAverageStrategies): Use a wider window in Simple Moving Average by default. 2015-02-10 Ryosuke Niwa Unreviewed build fix. * public/v2/app.js: (set get App.Pane.Ember.Object.extend): 2015-02-10 Ryosuke Niwa New perf dashboard should have the ability to overlay moving average with an envelope https://bugs.webkit.org/show_bug.cgi?id=141438 Reviewed by Andreas Kling. This patch adds three kinds of moving average strategies and two kinds of enveloping strategies: Simple Moving Average - The moving average x̀„_i of x_i is computed as the arithmetic mean of values from x_(i - n) though x_(i + m) where n is a non-negative integer and m is a positive integer. It takes n, backward window size, and m, forward window size, as an argument. Cumulative Moving Average - x̀„_i is computed as the arithmetic mean of all values x_0 though x_i. That is, x̀„_1 = x_1 and x̀„_i = ((i - 1) * M_(i - 1) + x_i) / i for all i > 1. Exponential Moving Average - x̀„_i is computed as the weighted average of x_i and x̀„_(i - 1) with α as an argument specifying x_i's weight. To be precise, x̀„_1 = x_1 and x̀„_i = α * x_i + (α - 1) x̀„_(i-1). Average Difference - The enveloping delta d is computed as the arithmetic mean of the difference between each x_i and x̀„_i. Moving Average Standard Deviation - d is computed like the standard deviation except the deviation for each term is measured from the moving average instead of the sample arithmetic mean. i.e. it uses the average of (x_i - x̀„_i)^2 as the "sample variance" instead of the conventional (x_i - x̀„)^2 where x̀„ is the sample mean of all x_i's. This change was necessary since our time series is non-stationary. Each strategy is cloned for an App.Pane instance so that its parameterList can be configured per pane. The configuration of the currently chosen strategies is saved in the query string for convenience. Also added the "stat pane" to choose a moving average strategy and a enveloping strategy in each pane. * public/v2/app.css: Specify the fill color for all SVG groups in the pane toolbar icons. * public/v2/app.js: (App.Pane._fetch): Delegate the creation of 'chartData' to _computeChartData. (App.Pane.updateStatisticsTools): Added. Clones moving average and enveloping strategies for this pane. (App.Pane._cloneStrategy): Added. Clones a strategy for a new pane. (App.Pane._configureStrategy): Added. Finds and configures a strategy from the configuration retrieved from the query string via ChartsController. (App.Pane._computeChartData): Added. Creates chartData from fetchedData. (App.Pane._computeMovingAverage): Added. Computes the moving average and the envelope. (App.Pane._executeStrategy): Added. (App.Pane._updateStrategyConfigIfNeeded): Pushes the strategy configurations to the query string via ChartsController. (App.ChartsController._parsePaneList): Merged the query string arguments for the range and point selections, and added two new arguments for the moving average and the enveloping configurations. (App.ChartsController._serializePaneList): Ditto. (App.ChartsController._scheduleQueryStringUpdate): Observes strategy configurations. (App.PaneController.actions.toggleBugsPane): Hides the stat pane. (App.PaneController.actions.toggleSearchPane): Hides the stat pane. (App.PaneController.actions.toggleStatPane): Added. * public/v2/chart-pane.css: Added CSS rules for the new stat pane. Also added .foreground class for the current (as opposed to baseline and target) time series for when it's the most foreground graph without moving average and its envelope overlapping on top of it. * public/v2/index.html: Added the templates for the stat pane and the corresponding icon (Σ). * public/v2/interactive-chart.js: (App.InteractiveChartComponent.chartDataDidChange): Unset _totalWidth and _totalHeight to avoid exiting early inside _updateDimensionsIfNeeded when chartData changes after the initial layout. (App.InteractiveChartComponent.didInsertElement): Attach event listeners here instead of inside _constructGraphIfPossible since that could be called multiple times on the same SVG element. (App.InteractiveChartComponent._constructGraphIfPossible): Clear down the old SVG element we created but don't bother removing individual paths and circles. Added the code to show the moving average time series when there is one. Also add "foreground" class on SVG elements for the current time series when we're not showing the moving average. chart-pane.css has been updated to "dim down" the current time series when "foreground" is not set. (App.InteractiveChartComponent._minMaxForAllTimeSeries): Take the moving average time series into account when computing the y-axis range. (App.InteractiveChartComponent._brushChanged): Removed 'selectionIsLocked' argument as it's useless. * public/v2/js/statistics.js: (Statistics.MovingAverageStrategies): Added. (Statistics.EnvelopingStrategies): Added. 2015-02-06 Ryosuke Niwa The delta value in the chart pane sometimes doens't show '+' for a positive delta https://bugs.webkit.org/show_bug.cgi?id=141340 Reviewed by Andreas Kling. The bug was caused by computeStatus prefixing the value delta with '+' if it's greater than 0 after it had already been formatted. Fixed the bug by using a formatter that always emits a sign symbol. * public/v2/app.js: (App.Pane.computeStatus): (App.createChartData): 2015-02-06 Ryosuke Niwa Unreviewed build fix. currentPoint wasn't defined when selectedPoints was used to find points. * public/v2/app.js: (App.PaneController._updateDetails): 2015-02-06 Ryosuke Niwa Unreviewed. Commit the forgotten change. * public/include/manifest.php: 2015-02-06 Ryosuke Niwa New perf dashboard should have multiple dashboard pages https://bugs.webkit.org/show_bug.cgi?id=141339 Reviewed by Chris Dumez. Added the support for multiple dashboard pages. Also added the status of the latest data point. e.g. "5% better than target" * public/v2/app.css: Tweaked the styles to work around the fact Ember.js creates empty script elements. Also hid the border lines around charts on the dashboard page for a cleaner look. * public/v2/app.js: (App.IndexRoute): Added. Navigate to /dashboard/ once the manifest.json is loaded. (App.IndexRoute.beforeModel): Added. (App.DashboardRoute): Added. (App.DashboardRoute.model): Added. Return the dashboard specified by the name. (App.CustomDashboardRoute): Added. This route is used for a customized dashboard specified by "grid". (App.CustomDashboardRoute.model): Create a dashboard model from "grid" query parameter. (App.CustomDashboardRoute.renderTemplate): Use the dashboard template. (App.DashboardController): Renamed from App.IndexController. (App.DashboardController.modelChanged): Renamed from gridChanged. Removed the code to deal with "grid" and "defaultDashboard" as these are taken care of by newly added routers. (App.DashboardController.computeGrid): Renamed from updateGrid. No longer updates "grid" since this is now done in actions.toggleEditMode. (App.DashboardController.actions.toggleEditMode): Navigate to CustomDashboardRoute when start editing an existing dashboard. (App.Pane.computeStatus): Moved from App.PaneController so that to be called in App.Pane.latestStatus. Also moved the code to compute the delta with respect to the previous data point from _updateDetails. (App.Pane._relativeDifferentToLaterPointInTimeSeries): Ditto. (App.Pane.latestStatus): Added. Used by the dashboard template to show the status of the latest result. (App.createChartData): Added deltaFormatter to show less significant digits for differences. (App.PaneController._updateDetails): Updated per changes to computeStatus. * public/v2/chart-pane.css: Added style rules for the status labels on the dashboard. * public/v2/data.js: (TimeSeries.prototype.lastPoint): Added. * public/v2/index.html: Prefetch manifest.json as soon as possible, show the latest data points' status on the dashboard, and enumerate all predefined dashboards. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._relayoutDataAndAxes): Slightly adjust the offset at which we show unit for the dashboard page. * public/v2/manifest.js: (App.Dashboard): Inherit from App.NameLabelModel now that each predefined dashboard has a name. (App.MetricSerializer.normalizePayload): Parse all predefined dashboards instead of a single dashboard. IDs are generated for each dashboard for forward compatibility. (App.Manifest): (App.Manifest.dashboardByName): Added. (App.Manifest.defaultDashboardName): Added. (App.Manifest._fetchedManifest): Create dashboard model objects for all predefined ones. 2015-02-05 Ryosuke Niwa Move commits viewer to the end of details view https://bugs.webkit.org/show_bug.cgi?id=141315 Rubber-stamped by Andreas Kling. Show the difference instead of the old value per kling's request. * public/v2/app.js: (App.PaneController._updateDetails): * public/v2/index.html: 2015-02-05 Ryosuke Niwa Move commits viewer to the end of details view https://bugs.webkit.org/show_bug.cgi?id=141315 Reviewed by Andreas Kling. Improved the way list of commits are shown per kling's request. * public/v2/app.js: (App.PaneController._updateDetails): Always show the old value even when a single point is selected. * public/v2/chart-pane.css: Updated the style for the commits viewer. * public/v2/commits-viewer.js: (App.CommitsViewerComponent): Added "visible" property to hide the list of commits. (App.CommitsViewerComponent.actions.toggleVisibility): Added. Toggles "visible" property. * public/v2/index.html: Updated the template for commits viewer to support "visible" property. Also moved the commits viewers out of the details tables so that they don't interleave revision data. 2015-02-05 Ryosuke Niwa New perf dashboard should compare results to baseline and target https://bugs.webkit.org/show_bug.cgi?id=141286 Reviewed by Chris Dumez. Compare the selected value against baseline and target values as done in v1. e.g. "5% below target" Also use d3.format to format the selected value to show four significant figures. * public/v2/app.js: (App.Pane.searchCommit): (App.Pane._fetch): Create time series here via createChartData so that _computeStatus can use them to compute the status text without having to recreate them. (App.createChartData): Added. (App.PaneController._updateDetails): Use 3d.format on current and old values. (App.PaneController._computeStatus): Added. Computes the status text. (App.PaneController._relativeDifferentToLaterPointInTimeSeries): Added. (App.AnalysisTaskController._fetchedManifest): Use createChartData as done in App.Pane._fetch. Also format the values using chartData.formatter. * public/v2/chart-pane.css: Enlarge the status text. Show the status text in red if it's worse than the baseline and in blue if it's better than the target. * public/v2/data.js: (TimeSeries.prototype.findPointAfterTime): Added. * public/v2/index.html: Added a new tbody for the status text and the selected value. Also fixed the bug that we were not showing the old value's unit. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._constructGraphIfPossible): Use chartData.formatter. Also cleaned up the code to show the baseline and the target lines. * public/v2/manifest.js: (App.Manifest.fetchRunsWithPlatformAndMetric): Added smallerIsBetter. 2015-02-05 Ryosuke Niwa Unreviewed build fix. * public/v2/app.js: (App.IndexController.gridChanged): Use store.createRecord to create a custom dashboard as required by Ember.js 2015-02-04 Ryosuke Niwa New perf dashboard doesn't preserve the number of days when clicking on a dashboard chart https://bugs.webkit.org/show_bug.cgi?id=141280 Reviewed by Chris Dumez. Fixed the bug by passing in "since" as a query parameter to the charts page. Also fixed the styling issue that manifests when a JSON fetching fails on "Dashboard" page. * public/v2/app.css: Fixed CSS rules for error messages shown in the place of charts. * public/v2/app.js: (App.IndexController): Changed the default number of days from one month to one week. (App.IndexController._sharedDomainChanged): Set "since" property on the controller. * public/v2/index.html: Pass in "since" property on the controller as a query parameter. 2015-02-04 Ryosuke Niwa New perf dashboard erroneously clears zoom when poping history items https://bugs.webkit.org/show_bug.cgi?id=141278 Reviewed by Chris Dumez. The bug was caused by _sharedZoomChanged updating overviewSelection without updating mainPlotDomain. Updating overviewSelection resulted in _overviewSelectionChanged, which observes changes to overviewSelection, to schedule a call to propagateZoom, which in turn overrode "sharedZoom" we just parsed from the query string. * public/v2/app.js: (App.PaneController._overviewSelectionChanged): Don't schedule propagateZoom if the selected domain is already shown in the main plot. (App.PaneController._sharedZoomChanged): Set both overviewSelection and mainPlotDomain to avoid overriding "sharedZoom" via propagateZoom inside _overviewSelectionChanged. 2015-02-04 Ryosuke Niwa New perf dashboard shows null as the aggregator name if no aggregation is done https://bugs.webkit.org/show_bug.cgi?id=141256 Reviewed by Chris Dumez. Don't show the aggregator name if there isn't one. * public/v2/manifest.js: (App.Metric.label): 2015-02-04 Ryosuke Niwa Unreviewed build fix after r179611. * public/v2/interactive-chart.js: 2015-02-04 Ryosuke Niwa Perf dashboard doesn’t show the right unit for Safari UI tests https://bugs.webkit.org/show_bug.cgi?id=141238 Reviewed by Darin Adler. Safari UI tests use custom metrics that end with "Time". This patch teaches the perf dashboard how to get the unit for a given metric based on the suffix of the metric name instead of hard-coding the mapping between metrics and their units. * public/js/helper-classes.js: (PerfTestRuns): Use the suffix of the metric name to compute the unit. * public/v2/manifest.js: (App.Manifest.fetchRunsWithPlatformAndMetric): Ditto. Also set "useSI" property iff for "bytes". * public/v2/interactive-chart.js: (App.InteractiveChartComponent._constructGraphIfPossible): Respect useSI. Use toPrecision(3) otherwise. (App.InteractiveChartComponent._relayoutDataAndAxes): Place the unit vertically on the left of ticks. 2015-02-04 Ryosuke Niwa Interactive chart component provides two duplicate API for highlighting points https://bugs.webkit.org/show_bug.cgi?id=141234 Reviewed by Chris Dumez. Prior to this patch, the interactive chart component supported highlightedItems for finding commits on the main charts page and markedPoints to show the two end points in the analysis task page. This patch merges markedPoints into highlightedItems. * public/v2/app.js: (App.AnalysisTaskController._fetchedRuns): Use highlightedItems. * public/v2/chart-pane.css: * public/v2/index.html: Ditto. * public/v2/interactive-chart.js: (App.InteractiveChartComponent._constructGraphIfPossible): Make this._highlights an array instead of array of arrays. Also call _highlightedItemsChanged at the end to fix the bug that we never highlight items if highlightedItems was set before the initial layout. (App.InteractiveChartComponent._relayoutDataAndAxes): (App.InteractiveChartComponent._updateHighlightPositions): Now that highlights are circles instead of vertical lines, just set cx and cy as done for other "dots". (App.InteractiveChartComponent._highlightedItemsChanged): Exit early only if _clippedContainer wasn't already set; i.e. _constructGraphIfPossible hasn't been called. Also updated the logic to accommodate the fact this._highlights is an array of elements instead of an array of arrays of elements. Finally, set the radius of highlight circles here. 2015-02-03 Ryosuke Niwa Don’t use repository names as id’s. https://bugs.webkit.org/show_bug.cgi?id=141226 Reviewed by Chris Dumez. Not using repository names as their id's reduces the need to fetch the entire repositories table. Since names of repositories are available in manifest.json, we can resolve their names in the front end. * Websites/perf.webkit.org/public/api/runs.php: (parse_revisions_array): No longer uses $repository_id_to_name. (main): No longer populates $repository_id_to_name. * Websites/perf.webkit.org/public/api/triggerables.php: (main): Don't resolve repository names. * Websites/perf.webkit.org/public/include/manifest.php: (ManifestGenerator::repositories): Use repositories ids as keys in the result and include their names. (ManifestGenerator::bug_trackers): Don't resolve repository names. * Websites/perf.webkit.org/public/js/helper-classes.js: (TestBuild): Renamed repositoryName to repositoryId. (TestBuild.revision): Ditto. (TestBuild.formattedRevisions): Ditto. Continue to use the repository name in the formatted result since this is the text shown to human. * Websites/perf.webkit.org/public/v2/app.js: (App.pane.searchCommit): Renamed repositoryName to repositoryId. (App.PaneController._updateDetails): Ditto. (App.AnalysisTaskController.updateRoots): Ditto. * Websites/perf.webkit.org/public/v2/data.js: (Measurement): Ditto. (Measurement.prototype.commitTimeForRepository): Ditto. (Measurement.prototype.formattedRevisions): Ditto. * Websites/perf.webkit.org/public/v2/index.html: Use the repository name and the repository id as select element's label and value respectively. 2015-02-03 Ryosuke Niwa Unreviewed build fix. Declare $repository_id_to_name in the global scope. * public/api/runs.php: 2015-02-03 Ryosuke Niwa /api/runs.php should have main function https://bugs.webkit.org/show_bug.cgi?id=141220 Reviewed by Benjamin Poulain. Wrapped the code inside main function for clarity. * public/api/runs.php: 2015-01-27 Ryosuke Niwa Unreviewed build fix. "eta" isn't set on a in-progress build on a newly added builder. * tools/sync-with-buildbot.py: (find_request_updates): 2015-01-23 Ryosuke Niwa Perf dashboard always assigns the result of A/B testing with build request 1 https://bugs.webkit.org/show_bug.cgi?id=140382 Reviewed by Darin Adler. The bug was caused by the expression array_get($report, 'jobId') or array_get($report, 'buildRequest') which always evaluated to 1 when the report contained jobId. Fixed the bug by cascading array_get instead. Also fixed a typo as well as a bug that reports were never associated with builds. * public/include/report-processor.php: (ReportProcessor::process): Don't use "or" to find the non-null value since that always evaluates to 1 instead of the first non-null value. (ReportProcessor::resolve_build_id): Fixed the typo by adding the missing "$this->". (ReportProcessor::commit): Associate the report with the corresponding build as intended. 2015-01-23 Ryosuke Niwa Unreviewed typo fix. The prefix in triggerable_configurations is "trigconfig", not "trigrepo". * public/admin/tests.php: 2015-01-10 Ryosuke Niwa Unreviewed build fix. Removed the stale code. * public/admin/triggerables.php: 2015-01-09 Ryosuke Niwa Perf dashboard should have the ability to post A/B testing builds https://bugs.webkit.org/show_bug.cgi?id=140317 Rubber-stamped by Simon Fraser. This patch adds the support for triggering A/B testing from the perf dashboard. We add a few new tables to the database. "build_triggerables", which represents a set of builders that accept A/B testing. "triggerable_repositories" associates each "triggerable" with a fixed set of repositories for which an arbitrary revision can be specified for A/B testing. "triggerable_configurations" specifies a triggerable available on a given test on a given platform. "roots" table which specifies the revision used in a given root set in each repository. * init-database.sql: Added "build_triggerables", "triggerable_repositories", "triggerable_configurations", and "roots" tables. Added references to "build_triggerables", "platforms", and "tests" tables as well as columns to store status, status url, and creation time to build_requests table. Also made each test group's name unique in a given analysis task as it would be confusing to have multiple test groups of the same name. * public/admin/tests.php: Added the UI and the code to associate a test with a triggerable. * public/admin/triggerables.php: Added. Manages the list of triggerables as well as repositories for which a specific revision can be set in an A/B testing on a given triggerable. * public/api/build-requests.php: Added. Returns the list of open build requests on a specified triggerable. Also updates the status' and the status urls of specified build requests when buildRequestUpdates is provided in the raw POST data. (main): * public/api/runs.php: (fetch_runs_for_config): Don't include results associated with a build request, meaning they are results of an A/B testing. * public/api/test-groups.php: (main): Use the newly added BuildRequestsFetcher. Also merged fetch_test_groups_for_task back. * public/api/triggerables.php: Added. (main): Returns a list of triggerables or a triggerable associated with a given analysis task. * public/include/admin-header.php: * public/include/build-requests-fetcher.php: Added. Extracted from public/api/test-groups.php. (BuildRequestsFetcher): This class abstracts the process of fetching a list of builds requests and root sets used in those requests.D (BuildRequestsFetcher::__construct): (BuildRequestsFetcher::fetch_for_task): (BuildRequestsFetcher::fetch_for_group): (BuildRequestsFetcher::fetch_incomplete_requests_for_triggerable): (BuildRequestsFetcher::has_results): (BuildRequestsFetcher::results): (BuildRequestsFetcher::results_with_resolved_ids): (BuildRequestsFetcher::results_internal): (BuildRequestsFetcher::root_sets): (BuildRequestsFetcher::fetch_roots_for_set): * public/include/db.php: (Database::prefixed_column_names): Don't return "$prefix_" when there are no columns. (Database::insert_row): Support taking an empty array for values. This is useful in "root_sets" table since it only has the primary key, id, column. (Database::select_or_insert_row): (Database::update_or_insert_row): (Database::update_row): Added. (Database::_select_update_or_insert_row): Takes an extra argument specifying whether a new row should be inserted when no row matches the specified criteria. This is used while updating build_requests' status and url in public/api/build-requests.php since we shouldn't be inserting new build requests in that API. (Database::select_rows): Also use "1 == 1" in the select query when the query criteria is empty. This is used in public/api/triggerables.php when no analysis task is specified. * public/include/json-header.php: (find_triggerable_for_task): Added. Finds a triggerable available on a given test. We return the triggerable associated with the closest ancestor of the test. Since issuing a new query for each ancestor test is expensive, we retrieve triggerable for all ancestor tests at once and manually find the closest ancestor with a triggerable. * public/include/report-processor.php: (ReportProcessor::process): (ReportProcessor::resolve_build_id): Associate a build request with the newly created build if jobId or buildRequest is specified. * public/include/test-name-resolver.php: (TestNameResolver::map_metrics_to_tests): Store the entire metric row instead of its name so that test_exists_on_platform can use it. The last diff in public/admin/tests.php adopts this change. (TestNameResolver::test_exists_on_platform): Added. Returns true iff the test has ever run on a given platform. * public/include/test-path-resolver.php: Added. (TestPathResolver): This class abstracts the ancestor chains of a test. It retrieves the entire "tests" table to do this since there could be arbitrary number of ancestors for a given test. This class is a lot more lightweight than TestNameResolver, which retrieves a whole bunch of tables in order to compute full test metric names. (TestPathResolver::__construct): (TestPathResolver::ancestors_for_test): Returns the ordered list of ancestors from the closest to the highest (a test without a parent). (TestPathResolver::path_for_test): Returns a test "path", the ordered list of test names from the highest ancestor to the test itself. (TestPathResolver::ensure_id_to_test_map): Fetches "tests" table to construct id_to_test_map. * public/privileged-api/create-test-group.php: Added. An API to create A/B testing groups. (main): (commit_sets_from_root_sets): Given a dictionary of repository names to a pair of revisions for sets A and B respectively, returns a pair of arrays, each of which contains the corresponding set of "commits" for sets A and B respectively. e.g. {"WebKit": [1, 2], "Safari": [3, 4]} will result in [[WebKit commit at r1, Safari commit at r3], [WebKit commit at r2, Safari commit at r4]]. * public/v2/analysis.js: (App.AnalysisTask.testGroups): Takes arguments so that set('testGroups') will invalidate the cache. (App.AnalysisTask.triggerable): Added. Retrieves the triggerable associated with the task lazily. (App.TestGroup.rootSets): Added. Returns the list of root set ids used in this A/B testing group. (App.TestGroup.create): Added. Creates a new A/B testing group. (App.Triggerable): Added. (App.TriggerableAdapter): Added. (App.TriggerableAdapter.buildURL): Added. (App.BuildRequest.testGroup): Renamed from group. (App.BuildRequest.orderLabel): Added. One-based index to be used in labels. (App.BuildRequest.config): Added. Returns either 'A' or 'B' depending on the configuration used in this build request. (App.BuildRequest.status): Added. (App.BuildRequest.statusLabel): Added. Returns a human friendly label for the current status. (App.BuildRequest): Removed buildNumber, buildBuilder, as well as buildTime as they're unused. * public/v2/app.js: (App.AnalysisTaskController.testGroups): Added. (App.AnalysisTaskController.possibleRepetitionCounts): Added. (App.AnalysisTaskController.updateRoots): Renamed from roots. This is also no longer a property but an observer that updates "roots" property. Filter out the repositories that are not accepted by the associated triggerable as they will be ignored. (App.AnalysisTaskController.actions.createTestGroup): Added. * public/v2/index.html: Updated the UI, and added a form element to trigger createTestGroup action. * tools/sync-with-buildbot.py: Added. This scripts posts new builds on buildbot and reports back the status of those builds to the perf dashboard. A similar script can be written to support other continuous builds systems. (main): Fetches the list of pending builds as well as currently running or completed builds from a buildbot, and report new statuses of builds requests to the perf dashboard. It will then schedule a single new build on each builder with no pending builds, and marks the set of open build requests that have been scheduled to run on the buildbot but not found in the first step as stale. (load_config): Loads a JSON that contains the configurations for each builder. e.g. [ { "platform": "mac-mavericks", "test": ["Parser", "html5-full-render.html"], "builder": "Trunk Syrah Production Perf AB Tests", "arguments": { "forcescheduler": "force-mac-mavericks-release-perf", "webkit_revision": "$WebKit", "jobid": "$buildRequest" } } ] (find_request_updates): Return a list of build request status updates to make based on the pending builds as well as in-progress and completed builds on each builder on the buildbot. When a build is completed, we use the special status "failedIfNotCompleted" which results in "failed" status only if the build request had not been completed. This is necessary because a failed build will not report its failed-ness back to the perf dashboard in some cases; e.g. lost slave or svn up failure. (update_and_fetch_build_requests): Submit the build request status updates and retrieve the list of open requests the perf dashboard has. (find_stale_request_updates): Compute the list of build requests that have been scheduled on the buildbot but not found in find_request_updates. These build requests are lost. e.g. a master reboot or human canceling a build may trigger such a state. (schedule_request): Schedules a build with the arguments specified in the configuration JSON after replacing repository names with their revisions and buildRequest with the build request id. (config_for_request): Finds a builder for the test and the platform of a build request. (fetch_json): Fetches a JSON from the specified URL, optionally with BasicAuth. (property_value_from_build): Returns the value of a specific property in a buildbot build. (request_id_from_build): Returns the build request id of a given buildbot build if there is one. 2015-01-09 Ryosuke Niwa Cache-control should be set only on api/runs https://bugs.webkit.org/show_bug.cgi?id=140312 Reviewed by Andreas Kling. Some JSON APIs such as api/analysis-tasks can't be cached even for a short period of time (e.g. a few minutes) since they can be modified by the user on demand. Since only api/runs.php takes a long time to generate JSONs, just set cache-control there instead of json-header.php which is used by other JSON APIs. Also set date_default_timezone_set in db.php since we never use non-UTC timezone in our scripts. * public/api/analysis-tasks.php: * public/api/runs.php: Set the cache control headers. * public/api/test-groups.php: * public/include/db.php: Set the default timezone to UTC. * public/include/json-header.php: Don't set the cache control headers. 2015-01-09 Ryosuke Niwa api/report-commit should authenticate with a slave name and password https://bugs.webkit.org/show_bug.cgi?id=140308 Reviewed by Benjamin Poulain. Use a slave name and a password to authenticate new commit reports. * public/api/report-commits.php: (main): * public/include/json-header.php: (verify_slave): Renamed and repurposed from verify_builder in report-commits.php. Now authenticates with a slave name and a password instead of a builder name and a password. * tests/api-report-commits.js: Updated tests. * tools/pull-svn.py: (main): Renamed variables. (submit_commits): Submits slaveName and slavePassword instead of builderName and builderPassword. 2014-12-19 Ryosuke Niwa Perf dashboard should support authentication via a slave password https://bugs.webkit.org/show_bug.cgi?id=139837 Reviewed by Andreas Kling. For historical reasons, perf dashboard conflated builders and build slaves. As a result we ended up having to add multiple builders with the same password when a single build slave is shared among them. This patch introduces the concept of build_slave into the perf dashboard to end this madness. * init-database.sql: Added build_slave table as well as references to it in builds and reports. * public/admin/build-slaves.php: Added. * public/admin/builders.php: Added the support for updating passwords. * public/include/admin-header.php: (update_field): Takes an extra argument when a new value needs to be supplied by the caller instead of being retrieved from $_POST. (AdministrativePage::render_table): Use array_get to retrieve a value out of the database row since the raw may not exist (e.g. new_password). (AdministrativePage::render_form_to_add): Added the support for post_insertion. Don't render the form control here when this flag evaluates to TRUE. * public/include/report-processor.php: (ReportProcessor::process): Added the logic to authenticate with slaveName and slavePassword if those values are present in the report. In addition, try authenticating builderName with slavePassword if builderPassword is not specified. When neither password is specified, exit with BuilderNotFound. Also insert the slave or the builder whichever is missing after we've successfully authenticated. (ReportProcessor::construct_build_data): Takes a builder ID and an optional slave ID instead of a builder row. (ReportProcessor::store_report): Store the slave ID with the report. (ReportProcessor::resolve_build_id): Exit with MismatchingBuildSlave when the slave associated with the matching build is different from what's being reported. * tests/api-report.js: Added a bunch of tests to test the new features of /api/report. (.addSlave): Added. 2014-12-18 Ryosuke Niwa New perf dashboard should not duplicate author information in each commit https://bugs.webkit.org/show_bug.cgi?id=139756 Reviewed by Darin Adler. Instead of each commit having author name and email, make it reference a newly added committers table. Also replace "email" by "account" since some repositories don't use emails as account names. This improves the keyword search performance in commits.php since LIKE now runs on committers table, which only contains as many rows as there are accounts in each repository, instead of commits table which contains every commit ever happened in each repository. To migrate an existing database into match the new schema, run: BEGIN; INSERT INTO committers (committer_repository, committer_name, committer_email) (SELECT DISTINCT commit_repository, commit_author_name, commit_author_email FROM commits WHERE commit_author_email IS NOT NULL); ALTER TABLE commits ADD COLUMN commit_committer integer REFERENCES committers ON DELETE CASCADE; UPDATE commits SET commit_committer = committer_id FROM committers WHERE commit_repository = committer_repository AND commit_author_email = committer_email; ALTER TABLE commits DROP COLUMN commit_author_name CASCADE; ALTER TABLE commits DROP COLUMN commit_author_email CASCADE; COMMIT; * init-database.sql: Added committers table, and replaced author columns in commits table by a foreign reference to committers. Also added the missing drop table statements. * public/api/commits.php: (main): Fetch the corresponding committers row for a single commit. Also wrap a single commit by an array here instead of doing it in format_commit. (fetch_commits_between): Updated queries to JOIN commits with committers. (format_commit): Takes both commit and committers rows. Also don't wrap the result in an array as that is now done in main. * public/api/report-commits.php: (main): Store the reported committer information or update the existing entry if there is one. * tests/admin-regenerate-manifest.js: Fixed tests. * tests/api-report-commits.js: Ditto. Also added a test for updating an existing committer entry. * tools/pull-svn.py: Renamed email to account. (main): (fetch_commit_and_resolve_author): (fetch_commit): (resolve_author_name_from_account): (resolve_author_name_from_email): Deleted. 2014-12-17 Ryosuke Niwa Unreviewed build fix. * public/v2/index.html: Include js files we extracted in r177424. 2014-12-16 Ryosuke Niwa Unreviewed. Adding the forgotten svnprop. * tools/pull-svn.py: Added property svn:executable. 2014-12-16 Ryosuke Niwa Split InteractiveChartComponent and CommitsViewerComponent into separate files https://bugs.webkit.org/show_bug.cgi?id=139716 Rubber-stamped by Benjamin Poulain. Refactored InteractiveChartComponent and CommitsViewerComponent out of app.js into commits-viewer.js and interactive-chart.js respectively since app.js has gotten really large. * public/v2/app.js: * public/v2/commits-viewer.js: Added. * public/v2/interactive-chart.js: Added. 2014-12-02 Ryosuke Niwa New perf dashboard's chart UI is buggy https://bugs.webkit.org/show_bug.cgi?id=139214 Reviewed by Chris Dumez. The bugginess was caused by weird interactions between charts and panes. Rewrote the code to fix it. Superfluous selectionChanged and domainChanged "event" actions were removed from the interactive chart component. This is not how Ember.js components should interact to begin with. The component now exposes selectedPoints and always updates selection instead of sharedSelection. * public/v2/app.js: (App.ChartsController.present): Added. We can't call Date.now() in various points in our code as that would lead to infinite mutual recursions since X-axis domain values wouldn't match up. (App.ChartsController.updateSharedDomain): This function was completely useless. The overview's start and end time should be completely determined by "since" and the present time. (App.ChartsController._startTimeChanged): Ditto. (App.ChartsController._scheduleQueryStringUpdate): (App.ChartsController._updateQueryString): Set "zoom" only if it's different from the shared domain. (App.domainsAreEqual): Moved from InteractiveChartComponent._xDomainsAreSame. (App.PaneController.actions.createAnalysisTask): Use selectedPoints property set by the chart. (App.PaneController.actions.overviewDomainChanged): Removed; only needed to call updateSharedDomain. (App.PaneController.actions.rangeChanged): Removed. _showDetails (renamed to _updateDetails) directly observes the changes to selectedPoints property as it gets updated by the main chart. (App.PaneController._overviewSelectionChanged): This was previously a dead code. Now it's used again with a bug fix. When the overview selection is cleared, we use the same domain in the main chart and the overview chart. (App.PaneController._sharedDomainChanged): Fixed a but that it erroneously updates the overview domain when domain arrays aren't identical. This was causing a subtle race with other logic. (App.PaneController._sharedZoomChanged): Ditto. Also don't set mainPlotDomain here as any changes to overviewSelection will automatically propagate to the main plot's domain as they're aliased. (App.PaneController._currentItemChanged): Merged into _updateDetails (renamed from _showDetails). (App.PaneController._updateDetails): Previously, this function took points and inspected _hasRange to see if those two points correspond to a range or a single data point. Rewrote all that logic by directly observing selectedPoints and currentItem properties instead of taking points and relying on an instance variable, which was a terrible API. (App.PaneController._updateCanAnalyze): Use selectedPoints property. Since this property is only set when the main plot has a selected range, we don't have to check this._hasRange anymore. (App.InteractiveChartComponent._updateDomain): No longer sends domainChanged "event" action. (App.InteractiveChartComponent._sharedSelectionChanged): Removed. This is a dead code. (App.InteractiveChartComponent._updateSelection): (App.InteractiveChartComponent._xDomainsAreSame): Moved to App.domainsAreEqual. (App.InteractiveChartComponent._setCurrentSelection): Update the selection only if needed. Also set selectedPoints property. (App.AnalysisTaskController._fetchedRuns): (App.AnalysisTaskController._rootChangedForTestSet): * public/v2/index.html: Removed non-functional sharedSelection and superfluous selectionChanged and domainChanged actions. 2014-11-21 Ryosuke Niwa Unreviewed. Fixed syntax errors. * init-database.sql: * public/api/commits.php: 2014-11-21 Ryosuke Niwa The dashboard on new perf monitor should be configurable https://bugs.webkit.org/show_bug.cgi?id=138994 Reviewed by Benjamin Poulain. For now, make it configurable via config.json. We should eventually make it configurable via an administrative page but this will do for now. * config.json: Added the empty dashboard configuration. * public/include/manifest.php: Include the dashboard configuration in the manifest file. * public/v2/app.js: (App.IndexController): Removed defaultTable since this is now dynamically obtained via App.Manifest. (App.IndexController.gridChanged): Use App.Dashboard to parse the dashboard configuration. Also obtain the default configuration from App.Manifest. (App.IndexController._normalizeTable): Moved to App.Dashboard. * public/v2/manifest.js: (App.Repository.urlForRevision): Fixed the position of the open curly bracket. (App.Repository.urlForRevisionRange): Ditto. (App.Dashboard): Added. (App.Dashboard.table): Extracted from App.IndexController.gridChanged. (App.Dashboard.rows): Ditto. (App.Dashboard.headerColumns): Ditto. (App.Dashboard._normalizeTable): Moved from App.IndexController._normalizeTable. (App.MetricSerializer.normalizePayload): Synthesize a dashboard record from the configuration. Since there is exactly one dashboard object per app, it's okay to hard code an id here. (App.Manifest._fetchedManifest): Set defaultDashboard to the one and only one dashboard we have. 2014-11-21 Ryosuke Niwa There should be a way to associate bugs with analysis tasks https://bugs.webkit.org/show_bug.cgi?id=138977 Reviewed by Benjamin Poulain. Updated associate-bug.php to match the new database schema. * public/include/json-header.php: (require_format): Removed the call to camel_case_words_separated_by_underscore since the name is already camel-cased in require_existence_of. This makes the function usable elsewhere. * public/privileged-api/associate-bug.php: (main): Changed the API to take run, bugTracker, and number to match the new database schema. Also verify that those values are integers using require_format. * public/v2/analysis.js: (App.AnalysisTask.label): Added. Concatenates the task's name with the bug numbers. (App.Bug.label): Added. (App.BugAdapter): Added. (App.BugAdapter.createRecord): Use PrivilegedAPI instead of the builtin ajax call. (App.BuildRequest): Inherit from newly added App.Model, which is set to DS.Model right now. * public/v2/app.css: Renamed .test-groups to .analysis-group. Also added new rules for the table containing the bug information. * public/v2/app.js: (App.InteractiveChartComponent._rangesChanged): Added label to range bar objects. (App.AnalysisTaskRoute): (App.AnalysisTaskController): Replaced the functionality of App.AnalysisTaskViewModel. (App.AnalysisTaskController._fetchedManifest): Added. (App.AnalysisTaskController.actions.associateBug): Added. * public/v2/chart-pane.css: Renamed .bugs-pane to .analysis-pane. * public/v2/data.js: (Measurement.prototype.associateBug): Deleted. * public/v2/index.html: Renamed .bugs-pane to .analysis-pane and .test-groups to .analysis-group. Added a table show the bug information. Also hide the chart until chartData is available. * public/v2/manifest.js: (App.Model): Added. 2014-11-20 Ryosuke Niwa Fix misc bugs and typos in app.js https://bugs.webkit.org/show_bug.cgi?id=138946 Reviewed by Benjamin Poulain. * public/v2/app.js: (App.DashboardPaneProxyForPicker._platformOrMetricIdChanged): (App.ChartsController.init): (App.buildPopup): Renamed from App.BuildPopup. (App.InteractiveChartComponent._constructGraphIfPossible): Fixed the bug that we were calling remove() on the wrong object (an array as opposed to elements in the array). (App.InteractiveChartComponent._highlightedItemsChanged): Check the length of _highlights as _highlights is always an array and evalutes to true. 2014-11-20 Ryosuke Niwa New perf dashboard should provide UI to create a new analysis task https://bugs.webkit.org/show_bug.cgi?id=138910 Reviewed by Benjamin Poulain. This patch reverts some parts of r175006 and re-introduces bugs associated with analysis tasks. I'll add UI to show and edit bug numbers associated with an analysis task in a follow up patch. With this patch, we can create a new analysis task by selection a range of points and opening "analysis pane" (renamed from "bugs pane"). Each analysis task created is represented by a yellow bar in the chart hyperlinked to the analysis task. * init-database.sql: Redefined the bugs to be associated with an analysis task instead of a test run. * public/api/analysis-tasks.php: Added the support for querying analysis tasks for a specific metric on a specific platform. Also retrieve and return all bugs associated with analysis tasks. (main): (fetch_and_push_bugs_to_tasks): Added. Fetches all bugs associated with an array of analysis tasks and adds the associated bugs to each task in the array. (format_task): * public/api/runs.php: Reverted changes made in r175006. (fetch_runs_for_config): (format_run): * public/api/test-groups.php: (fetch_test_groups_for_task): Use the newly added Database::select_rows. * public/include/db.php: (Database::select_first_or_last_row): (Database::select_rows): Extracted from select_first_or_last_row. * public/v2/analysis.js: (App.AnalysisTask): Added "bugs" property. (App.Bug): Added now that bugs are regular data store objects. * public/v2/app.js: (App.Pane._fetch): Calls this.fetchAnalyticRanges to fetch analysis tasks as well as test runs. (App.Pane.fetchAnalyticRanges): Added. Fetches analysis tasks for the current metric on the current platform that are associated with a specific range of runs. (App.PaneController.actions.toggleBugsPane): Updated per showingBugsPane to showingAnalysisPane rename. (App.PaneController.actions.associateBug): Deleted. (App.PaneController.actions.createAnalysisTask): Replaced the pre-condition checks with assertions as this action should never be triggered when the pre-condition is not met. Also re-fetch analysis tasks once we've created one. (App.PaneController.toggleSearchPane): Updated per showingBugsPane to showingAnalysisPane rename. (App.PaneController._detailsChanged): Ditto. Removed selectedSinglePoint since it's no longer used. (App.PaneController._showDetails): Call _updateCanAnalyze to update the status of "Analyze" button. (App.PaneController._updateBugs): Deleted. (App.PaneController._updateMarkedPoints): Deleted. (App.PaneController._updateCanAnalyze): Added. Disables the button to create an analysis task when the name is missing or when at most one point is selected. (App.InteractiveChartComponent._constructGraphIfPossible): Update the locations of range rects. (App.InteractiveChartComponent._relayoutDataAndAxes): Ditto. (App.InteractiveChartComponent._mousePointInGraph): Don't return a point unless the mouse cursor is on our svg element to avoid locking the current item when a bar shown for an analysis task is clicked. (App.InteractiveChartComponent._rangesChanged): Added. Creates an array of objects representing clickable bars for analysis tasks. (App.InteractiveChartComponent._updateRangeBarRects): Computes the inline style used by each clickable bar for analysis tasks to place them at the right location. (App.InteractiveChartComponent.actions.openRange): Added. Forwards the action to the parent controller. * public/v2/chart-pane.css: (.chart .extent): Use the same color as the vertical indicator in the highlight behind the selection. (.chart .rangeBar): Added. * public/v2/data.js: (TimeSeries.prototype.nextPoint): Added. Used by _rangesChanged. * public/v2/index.html: Renamed "bugs pane" to "analysis pane" and removed the UI to associate bugs. This ability will be reinstated in a follow up patch. Also added a container div and spans for analysis task bars in the interactive chart component. 2014-11-19 Ryosuke Niwa Fix typos in r176203. * public/v2/app.js: (App.ChartsController.actions.addPaneByMetricAndPlatform): (App.AnalysisTaskRoute): 2014-11-18 Ryosuke Niwa Unreviewed. Updated the install instruction. * Install.md: 2014-11-17 Ryosuke Niwa App.Manifest shouldn't use App.__container__.lookup https://bugs.webkit.org/show_bug.cgi?id=138768 Reviewed by Andreas Kling. Removed the hack to find the store object via App.__container__.lookup. Pass around the store object instead. * public/v2/app.js: (App.DashboardRow._createPane): Add "store" property to the pane. (App.DashboardPaneProxyForPicker._platformOrMetricIdChanged): Ditto. (App.IndexController.gridChanged): Ditto. (App.IndexController.actions.addRow): Ditto. (App.IndexController.init): Ditto. (App.Pane._fetch): Ditto. (App.ChartsController._parsePaneList): Ditto. (App.ChartsController._updateQueryString): Ditto. (App.ChartsController.actions.addPaneByMetricAndPlatform): Ditto. (App.BuildPopup): Ditto. (App.AnalysisTaskRoute.model): Ditto. (App.AnalysisTaskViewModel._taskUpdated): Ditto. * public/v2/manifest.js: (App.Manifest.fetch): Removed the code to find the store object. 2014-11-08 Ryosuke Niwa Fix Ember.js warnings the new perf dashboard https://bugs.webkit.org/show_bug.cgi?id=138531 Reviewed by Darin Adler. Fixed various warnings. * public/v2/app.js: (App.InteractiveChartComponent._relayoutDataAndAxes): We can't use "rem". Use this._rem as done for x. * public/v2/data.js: (PrivilegedAPI._post): Removed the superfluous console.log. (CommitLogs.fetchForTimeRange): Ditto. * public/v2/index.html: Added tbody as required by the HTML specification. 2014-11-07 Ryosuke Niwa Fix typos in r175768. * public/v2/app.js: (App.AnalysisTaskViewModel.roots): 2014-11-07 Ryosuke Niwa Introduce the concept of analysis task to perf dashboard https://bugs.webkit.org/show_bug.cgi?id=138517 Reviewed by Andreas Kling. Introduced the concept of an analysis task, which is created for a range of measurements for a given metric on a single platform and used to bisect regressions in the range. Added a new page to see the list of active analysis tasks and a page to view the contents of an analysis task. * init-database.sql: Added a bunch of tables to store information about analysis tasks. analysis_tasks - Represents each analysis task. Associated with a platform and a metric and possibly with two test runs. Analysis tasks not associated with test runs are used for try new patches. analysis_test_groups - A test group in an analysis task represents a bunch of related A/B testing results. root_sets - A root set represents a set of roots (or packages) installed in each A/B testing. build_requests - A build request represents a single pending build for A/B testing. * public/api/analysis-tasks.php: Added. Returns the specified analysis task or all analysis tasks in an array. (main): (format_task): * public/api/test-groups.php: Added. Returns analysis task groups for the specified analysis task or returns the specified analysis task group as well as build requests associated with them. (main): (fetch_test_groups_for_task): (fetch_build_requests_for_task): (fetch_build_requests_for_group): (format_test_group): (format_build_request): * public/include/json-header.php: (remote_user_name): Extracted from compute_token so that we can use it in create-analysis-task.php. (compute_token): * public/privileged-api/associate-bug.php: (main): Fixed a typo. * public/privileged-api/create-analysis-task.php: Added. Creates a new analysis task for a given test run range. (main): (ensure_row_by_id): (ensure_config_from_runs): * public/privileged-api/generate-csrf-token.php: Use remote_user_name. * public/v2/analysis.js: Added. Various Ember data store models to represent analysis tasks and related objects. (App.AnalysisTask): (App.AnalysisTask.create): (App.TestGroup): (App.TestGroupAdapter): (App.AnalysisTaskSerializer): (App.TestGroupSerializer): (App.BuildRequest): * public/v2/app.css: Added style rules for the analysis page. * public/v2/app.js: (App.Pane._fetch): Use fetchRunsWithPlatformAndMetric, which has been refactored into App.Manifest. (App.PaneController.actions.toggleBugsPane): Show bugs pane even when there are no bug trackers or there is not exactly one selected point as we can still create an analysis task. (App.PaneController.actions.associateBug): Renamed singlySelectedPoint to selectedSinglePoint to be more grammatical and also alert'ed the error message when there is one. (App.PaneController.actions.createAnalysisTask): Added. Creates a new analysis task and opens it in a new tab. Since window.open only works during the click, we open the new "window" preemptively and navigates or closes it once XHR request has completed. (App.PaneController._detailsChanged): Changes due to singlySelectedPoint to selectedSinglePoint rename. (App.PaneController._updateBugs): Fixed a bug that we were showing bugs in the previous point when a single point is selected in the details pane. (App.AnalysisRoute): Added. (App.AnalysisTaskRoute): Added. (App.AnalysisTaskViewModel): Added. (App.AnalysisTaskViewModel._taskUpdated): Fetch runs for the associated platform and metric. (App.AnalysisTaskViewModel._fetchedRuns): Setup the chart data to show. (App.AnalysisTaskViewModel.testSets): The computed property used to update roots for all repositories/projects. (App.AnalysisTaskViewModel._rootChangedForTestSet): Updates root selections for all repositories/projects when the user selects an option for all roots in A or B configuration. (App.AnalysisTaskViewModel.roots): The computed property used to show root choices for each repository/project. * public/v2/chart-pane.css: Added style rules for details view in the analysis task page. * public/v2/data.js: (Measurement.prototype._formatRevisionRange): Don't prefix a revision number with "At " when there is no previous point so that we can use it in App.AnalysisTaskViewModel.roots. (TimeSeries.prototype.findPointByMeasurementId): Added. (TimeSeries.prototype.seriesBetweenPoints): Added. * public/v2/index.html: Use Metric.fullName since the same value is needed in the analysis task page. Also added a button to create an analysis task, and made bugs pane button always enabled since we can an analysis task even when multiple points are selected. Finally, added a new template for the analysis task page. * public/v2/manifest.js: (App.Metric.fullName): Added to share code between the charts page and the analysis task page. (App.Manifest.fetchRunsWithPlatformAndMetric): Extracted from App.Pane._fetch to be reused in App.AnalysisTaskViewModel._taskUpdated. 2014-10-28 Ryosuke Niwa Remove App.PaneController.bugsChangeCount in the new perf dashboard https://bugs.webkit.org/show_bug.cgi?id=138111 Reviewed by Darin Adler. * public/v2/app.js: (App.PaneController.bugsChangeCount): Removed. (App.PaneController.actions.associateBug): Call _updateMarkedPoints instead of incrementing bugsChangeCount. (App.PaneController._updateMarkedPoints): Extracted from App.InteractiveChartComponent._updateDotsWithBugs. Finds the list of current run's points that are associated with bugs. (App.InteractiveChartComponent._updateMarkedDots): Renamed from _updateDotsWithBugs. * public/v2/chart-pane.css: (.chart .marked): Renamed from .hasBugs. * public/v2/index.html: Specify chartPointRadius and markedPoints. 2014-10-27 Ryosuke Niwa REGRESSION: commit logs are not shown sometimes on the new dashboard UI https://bugs.webkit.org/show_bug.cgi?id=138099 Reviewed by Benjamin Poulain. The bug was caused by _currentItemChanged not passing the previous point in the list of points and also _showDetails inverting the order of the current and old measurements. * public/v2/app.js: (App.PaneController._currentItemChanged): Pass in the previous point to _showDetails when there is one. (App.PaneController._showDetails): Since points are ordered chronologically, the last point is the current (latest) measurement and the first point is the oldest measurement. (App.CommitsViewerComponent.commitsChanged): Don't show a single measurement as a range for clarity. 2014-10-18 Ryosuke Niwa Perf dashboard should provide a way to associate bugs with a test run https://bugs.webkit.org/show_bug.cgi?id=137857 Reviewed by Andreas Kling. Added a "privileged" API, /privileged-api/associate-bug, to associate a bug with a test run. /privileged-api/ is to be protected by an authentication mechanism such as DigestAuth over https by the Apache configuration. The Cross Site Request (CSRF) Forgery prevention for privileged APIs work as follows. When a user is about to make a privileged API access, the front end code obtains a CSRF token generated by POST'ing to privileged-api/generate-csrf-token; the page sets a randomly generated salt and an expiration time via the cookie and returns a token computed from those two values as well as the remote username. The font end code then POST's the request along with the returned token. The server side code verifies that the specified token can be generated from the salt and the expiration time set in the cookie, and the token hasn't expired. * init-database.sql: Added bug_url to bug_trackers table, and added bugs table. Each bug tracker will have zero or exactly one bug associated with a test run. * public/admin/bug-trackers.php: Added the support for editing bug_url. * public/api/runs.php: (fetch_runs_for_config): Modified the query to fetch bugs associated with test_runs. (parse_bugs_array): Added. Parses the aggregated bugs and creates a dictionary that maps a tracker id to an associated bug if there is one. (format_run): Calls parse_bugs_array. * public/include/json-header.php: Added helper functions to deal for CSRF prevention. (ensure_privileged_api_data): Added. Dies immediately if the request's method is not POST or doesn't have a valid JSON payload. (ensure_privileged_api_data_and_token): Ditto. Also checks that the CSRF prevention token is valid. (compute_token): Computes a CSRF token using the REMOTE_USER (e.g. set via BasicAuth), the salt, and the expiration time stored in the cookie. (verify_token): Returns true iff the specified token matches what compute_token returns from the cookie. * public/include/manifest.php: (ManifestGenerator::bug_trackers): Include bug_url as bugUrl in the manifest. Also use tracker_id instead of tracker_name as the key in the manifest. This requires changes to both v1 and v2 front end. * public/index.html: (Chart..showTooltipWithResults): Updated for the manifest format changed mentioned above. * public/privileged-api/associate-bug.php: Added. (main): Added. Associates or dissociates a bug with a test run inside a transaction. It prevent a CSRF attack via ensure_privileged_api_data_and_token, which calls verify_token. * public/privileged-api/generate-csrf-token.php: Added. Generates a CSRF token valid for one hour. * public/v2/app.css: (.disabled .icon-button:hover g): Used by the "bugs" icon when a range of points or no points are selected in a chart. * public/v2/app.js: (App.PaneController.actions.toggleBugsPane): Added. Toggles the visibility of the bugs pane when exactly one point is selected in the chart. Also hides the search pane when making the bugs pane visible since they would overlap on each other if both of them are shown. (App.PaneController.actions.associateBug): Makes a privileged API request to associate the specified bug with the currently selected point (test run). Updates the bug information in "details" and colors of dots in the charts to reflect new states. Because chart data objects aren't real Ember objects for performance reasons, we have to use a dirty hack of modifying a dummy counter bugsChangeCount. (App.PaneController.actions.toggleSearchPane): Renamed from toggleSearch. Also hides the bugs pane when showing the search pane. (App.PaneController.actions.rangeChanged): Takes all selected points as the second argument instead of taking start and end points as the second and the third arguments so that _showDetails can enumerate all bugs in the selected range. (App.PaneController._detailsChanged): Added. Hide the bugs pane whenever a new point is selected. Also update singlySelectedPoint, which is used by toggleBugsPane and associateBug. (App.PaneController._currentItemChanged): Updated for the _showDetails change. (App.PaneController._showDetails): Takes an array of selected points in place of old arguments. Simplified the code to compute the revision information. Calls _updateBugs to format the associated bugs. (App.PaneController._updateBugs): Sets details.bugTrackers to a dictionary that maps a bug tracker id to a bug tracker proxy with an array of (bugNumber, bugUrl) pairs and also editedBugNumber, which is used by the bugs pane to associate or dissociate a bug number, if exactly one point is selected. (App.InteractiveChartComponent._updateDotsWithBugs): Added. Sets hasBugs class on dots as needed. (App.InteractiveChartComponent._setCurrentSelection): Finds and passes all points in the selected range to selectionChanged action instead of just finding the first and the last points. * public/v2/chart-pane.css: Updated the style. * public/v2/data.js: (PrivilegedAPI): Added. A wrapper for privileged APIs' CSRF tokens. (PrivilegedAPI.sendRequest): Makes a privileged API call. Fetches a new CSRF token if needed. (PrivilegedAPI._generateTokenInServerIfNeeded): Makes a request to privileged-api/generate-csrf-token if we haven't already obtained a CSRF token or if the token has already been expired. (PrivilegedAPI._post): Makes a single POST request to /privileged-api/* with a JSON payload. (Measurement.prototype.bugs): Added. (Measurement.prototype.hasBugs): Returns true iff bugs has more than one bug number. (Measurement.prototype.associateBug): Associates a bug with a test run via privileged-api/associate-bug. * public/v2/index.html: Added the bugs pane. Also added a list of bugs associated with the current run in the details. * public/v2/manifest.js: (App.BugTracker.bugUrl): (App.BugTracker.newBugUrl): Added. (App.BugTracker.repositories): Added. This was a missing back reference to repositories. (App.MetricSerializer.normalizePayload): Now parses/loads the list of bug trackers from the manifest. (App.Manifest.repositoriesWithReportedCommits): Now initialized to an empty array instead of null. (App.Manifest.bugTrackers): Added. (App.Manifest._fetchedManifest): Sets App.Manifest.bugTrackers. Also sorts the list of repositories by their respective ids to make the ordering stable. 2014-10-14 Ryosuke Niwa Remove unused jobs table https://bugs.webkit.org/show_bug.cgi?id=137724 Reviewed by Daniel Bates. Removed jobs table in the database as well as related code. * init-database.sql: * public/admin/jobs.php: Removed. * public/admin/tests.php: * public/include/admin-header.php: 2014-10-13 Ryosuke Niwa New perf dashboard should have an ability to search commits by a keyword https://bugs.webkit.org/show_bug.cgi?id=137675 Reviewed by Geoffrey Garen. /api/commits/ now accepts query parameters to search a commit by a keyword. Its output format changed to include "authorEmail" and "authorName" directly as columns instead of including an "author" object. This API change allows fetch_commits_between to generate results without processing Postgres query results. In the front end side, we've added a search pane in pane controller, and the interactive chart component now has a concept of highlighted items which is used to indicate commits found by the search pane. * public/api/commits.php: (main): Extract query parameters: keyword, from, and to and use that to fetch appropriate commits. (fetch_commits_between): Moved some code from main. Now takes a search term as the third argument. We look for a commit if its author name or email contains the keyword or if its revision matches the keyword. (format_commit): Renamed from format_commits. Now only formats one commit. * public/include/db.php: (Database::query_and_fetch_all): Now returns array() when the query results is empty (instead of false). * public/v2/app.css: Renamed .close-button to .icon-button since it's used by a search button as well. * public/v2/app.js: (App.Pane.searchCommit): Added. Finds the commits by a search term and assigns 'highlightedItems', which is a hash table that contains highlighted items' measurements' ids as keys. (App.PaneController.actions.toggleSearch): Toggles the visibility of the search pane. Also sets the default commit repository. (App.PaneController.actions.searchCommit): Delegates the work to App.Pane.searchCommit. (App.InteractiveChartComponent._constructGraphIfPossible): Fixed a bug that we weren't removing old this._dots. Added the code to initialize this._highlights. (App.InteractiveChartComponent._updateDimensionsIfNeeded): Updates dimensions of highlight lines. (App.InteractiveChartComponent._updateHighlightPositions): Added. Ditto. (App.InteractiveChartComponent._highlightedItemsChanged): Adds vertical lines for highlighted items and deletes the existing lines for the old highlighted items. (App.CommitsViewerComponent.commitsChanged): Updated the code per JSON API change mentioned above. Also fixed a bug that the code tries to update the commits viewer even if the viewer had already been destroyed. * public/v2/chart-pane.css: Added style for the search pane and the search button. * public/v2/data.js: Turned FetchCommitsForTimeRange into a class: CommitLogs. (CommitLogs): Added. (CommitLogs.fetchForTimeRange): Renamed from FetchCommitsForTimeRange. Takes a search term as an argument. (CommitLogs._cachedCommitsBetween): Extracted from FetchCommitsForTimeRange. (CommitLogs._cacheConsecutiveCommits): Ditto. (FetchCommitsForTimeRange._cachedCommitsByRepository): Deleted. (Measurement.prototype.commitTimeForRepository): Extracted from formattedRevisions. (Measurement.prototype.formattedRevisions): Uses formattedRevisions. Deleted the unused code for commitTime. * public/v2/index.html: Added the search pane and the search button. Also removed the unused attribute binding for showingDetails since this property is no longer used. * public/v2/manifest.js: (App.Manifest.repositories): Added. (App.Manifest.repositoriesWithReportedCommits): Ditto. Used by App.PaneController.actions.toggleSearch to find the default repository to search. (App.Manifest._fetchedManifest): Populates repositories and repositoriesWithReportedCommits. 2014-10-13 Ryosuke Niwa Unreviewed build fix after r174555. * public/include/manifest.php: (ManifestGenerator::generate): Assign an empty array to $repositories_with_commit when there are no commits. * tests/admin-regenerate-manifest.js: Fixed the test case. 2014-10-09 Ryosuke Niwa New perf dashboard UI tries to fetch commits all the time https://bugs.webkit.org/show_bug.cgi?id=137592 Reviewed by Andreas Kling. Added hasReportedCommits boolean to repository meta data in manifest.json, and used that in the front end to avoid issuing HTTP requests to fetch commit logs for repositories with no reported commits as they are all going to fail. Also added an internal cache to FetchCommitsForTimeRange in the front end to avoid fetching the same commit logs repeatedly. There are two data structures we cache: commitsByRevision which maps a given commit revision/hash to a commit object; and commitsByTime which is an array of commits sorted chronologically by time. * public/include/manifest.php: * public/v2/app.js: (App.CommitsViewerComponent.commitsChanged): * public/v2/data.js: (FetchCommitsForTimeRange): (FetchCommitsForTimeRange._cachedCommitsByRepository): * public/v2/manifest.js: (App.Repository): 2014-10-08 Ryosuke Niwa Another unreviewed build fix after r174477. Don't try to insert a duplicated row into build_commits as it results in a database constraint error. This has been caught by a test in /api/report. I don't know why I thought all tests were passing. * public/include/report-processor.php: 2014-10-08 Ryosuke Niwa Unreviewed build fix after r174477. * init-database.sql: Removed build_commits_index since it's redundant with build_commit's primary key. Also fixed a syntax error that we were missing "," after line that declared build_commit column. * public/api/runs.php: Fixed the query so that test_runs without commits data will be retrieved. This is necessary for baseline and target values manually added via admin pages. 2014-10-08 Ryosuke Niwa Add v2 UI for the perf dashboard https://bugs.webkit.org/show_bug.cgi?id=137537 Rubber-stamped by Andreas Kling. * public/v2: Added. * public/v2/app.css: Added. * public/v2/app.js: Added. * public/v2/chart-pane.css: Added. * public/v2/data.js: Added. * public/v2/index.html: Added. * public/v2/js: Added. * public/v2/js/d3: Added. * public/v2/js/d3/LICENSE: Added. * public/v2/js/d3/d3.js: Added. * public/v2/js/d3/d3.min.js: Added. * public/v2/js/ember-data.js: Added. * public/v2/js/ember.js: Added. * public/v2/js/handlebars.js: Added. * public/v2/js/jquery.min.js: Added. * public/v2/js/statistics.js: Added. * public/v2/manifest.js: Added. * public/v2/popup.js: Added. 2014-10-08 Ryosuke Niwa Remove superfluously duplicated code in public/api/report-commits.php. 2014-10-08 Ryosuke Niwa Perf dashboard should store commit logs https://bugs.webkit.org/show_bug.cgi?id=137510 Reviewed by Darin Adler. For the v2 version of the perf dashboard, we would like to be able to see commit logs in the dashboard itself. This patch replaces "build_revisions" table with "commits" and "build_commits" relations to store commit logs, and add JSON APIs to report and retrieve them. It also adds a tools/pull-svn.py to pull commit logs from a subversion directory. The git version of this script will be added in a follow up patch. In the new database schema, each revision in each repository is represented by exactly one row in "commits" instead of one row for each build in "build_revisions". "commits" and "builds" now have a proper many-to-many relationship via "build_commits" relations. In order to migrate an existing instance of this application, run the following SQL commands: BEGIN; INSERT INTO commits (commit_repository, commit_revision, commit_time) (SELECT DISTINCT ON (revision_repository, revision_value) revision_repository, revision_value, revision_time FROM build_revisions); INSERT INTO build_commits (commit_build, build_commit) SELECT revision_build, commit_id FROM commits, build_revisions WHERE commit_repository = revision_repository AND commit_revision = revision_value; DROP TABLE build_revisions; COMMIT; The helper script to submit commit logs can be used as follows: python ./tools/pull-svn.py "WebKit" https://svn.webkit.org/repository/webkit/ https://perf.webkit.org feeder-slave feeder-slave-password 60 "webkit-patch find-users" The above command will pull the subversion server at https://svn.webkit.org/repository/webkit/ every 60 seconds to retrieve at most 10 commits, and submits the results to https://perf.webkit.org using "feeder-slave" and "feeder-slave-password" as the builder name and the builder password respectively. The last, optional, argument is the shell command to convert a subversion account to the corresponding username. e.g. "webkit-patch find-users rniwa@webkit.org" yields "Ryosuke Niwa" in the stdout. * init-database.sql: Replaced "build_revisions" relation with "commits" and "build_commits" relations. * public/api/commits.php: Added. Retrieves a list of commits based on arguments in its path of the form /api/commits//. The behavior of this API depends on as follows: - Not specified - It returns every single commit for a given repository. - Matches "oldest" - It returns the commit with the oldest timestamp. - Matches "latest" - It returns the commit with the latest timestamp. - Matches "last-reported" - It returns the commit with the latest timestamp added via report-commits.php. - Is entirely alphanumeric - It returns the commit whose revision matches the filter. - Is of the form : or - - It retrieves the list of commits added via report-commits.php between two timestamps retrieved from commits whose revisions match the two alphanumeric values specified. Because it retrieves commits based on their timestamps, the list may contain commits that do not appear as neither hash's ancestor in git/mercurial. (main): (commit_from_revision): (fetch_commits_between): (format_commits): * public/api/report-commits.php: Added. A JSON API to report new subversion, git, or mercurial commits. See tests/api-report-commits.js for examples on how to use this API. * public/api/runs.php: Updated the query to use "commit_builds" and "commits" relations instead of "build_revisions". Regrettably, the new query is 20% slower but I'm going to wait until the new UI is ready to optimize this and other JSON APIs. * public/include/db.php: (Database::select_or_insert_row): (Database::update_or_insert_row): Added. (Database::_select_update_or_insert_row): Extracted from select_or_insert_row. Try to update first and then insert if the update fails for update_or_insert_row. Preserves the old behavior when $should_update is false. (Database::select_first_row): (Database::select_last_row): Added. (Database::select_first_or_last_row): Extracted from select_first_row. Fixed a bug that we were asserting $order_by to be not alphanumeric/underscore. Retrieve the last row instead of the first if $descending_order. * public/include/report-processor.php: (ReportProcessor::resolve_build_id): Store commits instead of build_revisions. We don't worry about the race condition for adding "build_commits" rows since we shouldn't have a single tester submitting the same result concurrently. Even if it happened, it will only result in a PHP error and the database will stay consistent. * run-tests.js: (pathToTests): Don't call path.resolve with "undefined" testName; It throws an exception in the latest node.js. * tests/api-report-commits.js: Added. * tests/api-report.js: Fixed a test per build_revisions to build_commits/commits replacement. * tools: Added. * tools/pull-svn.py: Added. See above for how to use this script. (main): (determine_first_revision_to_fetch): (fetch_revision_from_dasbhoard): (fetch_commit_and_resolve_author): (fetch_commit): (textContent): (resolve_author_name_from_email): (submit_commits): 2014-09-30 Ryosuke Niwa Update Install.md for Mavericks and fix typos https://bugs.webkit.org/show_bug.cgi?id=137276 Reviewed by Benjamin Poulain. Add the instruction to copy php.ini to enable the Postgres extension in PHP. Also use perf.webkit.org as the directory name instead of WebKitPerfMonitor. Finally, init-database.sql is no longer located inside database directory. * Install.md: 2014-08-11 Ryosuke Niwa Report run id's in api/runs.php for the new dashboard UI https://bugs.webkit.org/show_bug.cgi?id=135813 Reviewed by Andreas Kling. Include run_id in the generated JSON. * public/api/runs.php: (fetch_runs_for_config): Don't sort results by time since that has been done in the front end for ages now. (format_run): 2014-08-11 Ryosuke Niwa Merging platforms mixes baselines and targets into reported data https://bugs.webkit.org/show_bug.cgi?id=135260 Reviewed by Andreas Kling. When merging two platforms, move test configurations of a different type (baseline, target) as well as of different metric (Time, Runs). Also avoid fetching the entire table of runs just to see if there are no remaining runs. It's sufficient to detect one such test_runs object. * public/admin/platforms.php: (merge_platforms): 2014-07-30 Ryosuke Niwa Merging platforms mixes baselines and targets into reported data https://bugs.webkit.org/show_bug.cgi?id=135260 Reviewed by Geoffrey Garen. Make sure two test configurations we're merging are of the same type (e.g. baseline, target, current). Otherwise, we'll erroneously mix up runs for baseline, target, and current (reported values). * public/admin/platforms.php: 2014-07-23 Ryosuke Niwa Build fix after r171361. * public/js/helper-classes.js: (.this.formattedBuildTime): 2014-07-22 Ryosuke Niwa Perf dashboard spends 2s processing JSON data during the page loads https://bugs.webkit.org/show_bug.cgi?id=135152 Reviewed by Andreas Kling. In the Apple internal dashboard, we were spending as much as 2 seconds converting raw JSON data into proper JS objects while loading the dashboard. This caused the apparent unresponsiveness of the dashboard despite of the fact charts themselves updated almost instantaneously. * public/index.html: * public/js/helper-classes.js: (TestBuild): Compute the return values of formattedTime and formattedBuildTime lazily as creating new Date objects and running string replace is expensive. (TestBuild.formattedTime): (TestBuild.formattedBuildTime): (PerfTestRuns.setResults): Added. Pushing each result was the biggest bottle neck. (PerfTestRuns.addResult): Deleted. 2014-07-18 Ryosuke Niwa Perf dashboard shouldn't show the full git hash https://bugs.webkit.org/show_bug.cgi?id=135083 Reviewed by Benjamin Poulain. Detect Git/Mercurial hash by checking the length. If it's a hash, use the first 8 characters in the label while retaining the full length to be used in hyperlinks. * public/js/helper-classes.js: (.this.formattedRevisions): (TestBuild): 2014-05-29 Ryosuke Niwa Add an instruction on how to backup the database. https://bugs.webkit.org/show_bug.cgi?id=133391 Rubber-stamped by Andreas Kling. * Install.md: 2014-04-08 Ryosuke Niwa Build fix after r166479. 'bytes' is now abbreviated as 'B'. * public/js/helper-classes.js: (PerfTestRuns.smallerIsBetter): 2014-04-08 Ryosuke Niwa Some CSS teaks. * public/common.css: (#title): * public/index.html: (#charts .pane): (#charts .arrow): 2014-04-03 Ryosuke Niwa WebKitPerfMonitor: There should be a way to add all metrics of a suite without also adding subtests https://bugs.webkit.org/show_bug.cgi?id=131157 Reviewed by Andreas Kling. Split "all metrics" into all metrics of a test suite and all subtests of the suite. This allows, for example, adding all metrics such as Arithmetic and Geometric for a given test suite without also adding its subtests. * public/index.html: (init.showCharts): (init): 2014-04-03 Ryosuke Niwa WebKitPerfMonitor: Tooltips cannot be pinned after using browser's back button https://bugs.webkit.org/show_bug.cgi?id=131155 Reviewed by Andreas Kling. The bug was caused by Chart.attach binding event listeners on plot container on each call. This resulted in the click event handler toggling the visiblity of the tooltip twice upon click when attach() has been called even number of times, keeping the tooltip invisible. Fixed the bug by extracting the code to bind event listeners outside of Chart.attach as a separate function, bindPlotEventHandlers, and calling it exactly once when Chart.attach is called for the first time. * public/index.html: (Chart.attach): (Chart..bindPlotEventHandlers): 2014-04-03 Ryosuke Niwa WebKitPerfMonitor: Tooltips can be cut off at the top https://bugs.webkit.org/show_bug.cgi?id=130960 Reviewed by Andreas Kling. * public/common.css: (#title): Removed the gradients, box shadows, and border from the header. (#title h1): Reduce the font size. (#title ul): Use line-height to vertically align the navigation bar instead of specifying a padding atop. * public/index.html: (.tooltop:before): Added. Identical to .tooltop:after except it's upside down (arrow facing up). (.tooltip.inverted:before): Show the arrow facing up when .inverted is set. (.tooltip.inverted:before): Hide the arrow facing down when .inverted is set. * public/js/helper-classes.js: (Tooltip.show): Show the tooltip below the point if placing it above the point results in the top of the tooltip extending above y=0. 2014-04-03 Ryosuke Niwa WebKitPerfMonitor: Y-axis adjustment is too aggressive https://bugs.webkit.org/show_bug.cgi?id=130937 Reviewed by Andreas Kling. Previously, adjusted min. and max. were defined as the two standards deviations away from EWMA of measured results. This had two major problems: 1. Two standard deviations can be too small to show the confidence interval for results. 2. Sometimes baseline and target can be more than two standards deviations away. Fixed the bug by completely rewriting the algorithm to compute the interval. Instead of blindly using two standard deviations as margins, we keep adding quarter the standard deviation on each side until more than 90% of points lie in the interval or we've expanded 4 standard deviations. Once this condition is met, we reduce the margin on each side separately to reduce the empty space on either side. A more rigorous approach would involve computing least squared value of results with respect to intervals but that seems like an overkill for a simple UI problem; it's also computationally expensive. * public/index.html: (Chart..adjustedIntervalForRun): Extracted from computeYAxisBoundsToFitLines. (Chart..computeYAxisBoundsToFitLines): Compute the min. and max. adjusted intervals out of adjusted intervals for each runs (current, baseline, and target) so that at least one point from each set of results is shown. We wouldn't see the difference between measured values versus baseline and target values otherwise. * public/js/helper-classes.js: (PerfTestResult.unscaledConfidenceIntervalDelta): Returns the default value if the confidence interval delta cannot be computed. (PerfTestResult.isInUnscaledInterval): Added. Returns true iff the confidence intervals lies within the given interval. (PerfTestRuns..filteredResults): Extracted from unscaledMeansForAllResults now that PerfTestRuns.min and PerfTestRuns.max need to use both mean and confidence interval delta for each result. (PerfTestRuns..unscaledMeansForAllResults): (PerfTestRuns.min): Take the confidence interval delta into account. (PerfTestRuns.max): Ditto. (PerfTestRuns.countResults): Returns the number of results in the given time frame (> minTime). (PerfTestRuns.countResultsInInterval): Returns the number of results whose confidence interval lie within the given interval. (PerfTestRuns.exponentialMovingArithmeticMean): Fixed the typo so that it actually computes the EWMA. 2014-03-31 Ryosuke Niwa Some CSS tweaks after r166477 and r166479, * public/index.html: 2014-03-30 Ryosuke Niwa WebKitPerfMonitor: Sometimes text inside panes overlap https://bugs.webkit.org/show_bug.cgi?id=130956 Reviewed by Gyuyoung Kim. Revamped the pane UI. Now build info uses table element instead of plane text with BRs. The computed status of the latest result against baseline/target such as "3% until target" is now shown above the current value. This reduces the total height of the pane and fits more information per screen capita on the dashboard. * public/index.html: Updated and added a bunch of CSS rules for the new look. (.computeStatus): Don't append the build info here. The build info is constructed as a separate table now. (.createSummaryRowMarkup): Use th instead of td for "Current", "Baseline", and "Target" in the summary table. (.buildLabelWithLinks): Construct table rows instead of br separated lines of text. This streamlines the look of the build info shown in a chart pane and a tooltip. (Chart): Made .status a table. (Chart.populate): Prepend status.text, which contains text such as "3% until target", into the summary rows right above "Current" value, and populate .status with buildLabelWithLinks manually instead of status.text now that status.text no longer contains it. (Chart..showTooltipWithResults): Wrap buildLabelWithLinks with a table element. * public/js/helper-classes.js: (TestBuild.formattedRevisions): Don't include repository names in labels since repository names are now added by buildLabelWithLinks inside th elements. Also place spaces around '-' between two different OS X versions. e.g. "OS X 10.8 - OS X 10.9" instead of "OS X 10.8-OS X 10.9". (PerfTestRuns): Use "/s" for "runs/s" and "B" for "bytes" to make text shorter in .status and .summaryTable. (PerfTestRuns..computeScalingFactorIfNeeded): Avoid placing a space between 'M' and a unit starting with a capital letter; e.g. "MB" instead of "M B". 2014-03-30 Ryosuke Niwa WebKitPerfMonitor: Header and number-of-days slider takes up too much space https://bugs.webkit.org/show_bug.cgi?id=130957 Reviewed by Gyuyoung Kim. Moved the slider into the header. Also reduced the spacing between the header and platform names. This reclaims 50px Ă— width of the screen real estate. * public/common.css: (#title): Reduced the space below the header from 20px to 10px. * public/index.html: (#numberOfDaysPicker): Removed the rounded border around the number-of-days slider. (#dashboard > tbody > tr > td): Added a 1.5em padding at the bottom. (#dashboard > thead th): That allows us to remove the padding at the top here. This reduces the wasted screen real estate between the header and the platform names. 2014-03-10 Zoltan Horvath Update the install guidelines for perf.webkit.org https://bugs.webkit.org/show_bug.cgi?id=129895 Reviewed by Ryosuke Niwa. The current install guideline for perf.webkit.org discourages the use of the installed Server application. I've actualized the documentation for Mavericks, and modified the guideline to include the instructions for Server.app also. * Install.md: 2014-03-08 Zoltan Horvath Update perf.webkit.org json example https://bugs.webkit.org/show_bug.cgi?id=129907 Reviewed by Andreas Kling. The current example is not valid json syntax. I fixed the syntax errors and indented the code properly. * ReadMe.md: 2014-01-31 Ryosuke Niwa Merge database-common.js and utility.js into run-tests.js. Reviewed by Matthew Hanson. Now that run-tests is the only node.js script, merged database-common.js and utility.js into it. Also moved init-database.sql out of the database directory and removed the directory entirely. * database: Removed. * database/database-common.js: Removed. * database/utility.js: Removed. * init-database.sql: Moved from database/init-database.sql. * run-tests.js: (connect): Moved from database-common.js. (pathToDatabseSQL): Extracted from pathToLocalScript. (pathToTests): Moved from database-common.js. (config): Ditto. (TaskQueue): Ditto. (SerializedTaskQueue): Ditto. (main): (initializeDatabase): (TestEnvironment.it): (TestEnvironment.queryAndFetchAll): (sendHttpRequest): 2014-01-30 Ryosuke Niwa Remove the dependency on node.js from the production code. Reviewed by Ricky Mondello. Work towards Upstream SafariPerfMonitor. Removed node.js dependency from TestRunsGenerator. It was really a design mistake to invoke node.js from php. It added so much complexity with only theoretical extensibility of adding aggregators. It turns out that many aggregators we'd like to add are a lot more complicated than ones that could be written under the current infrastructure, and we need to make the other aspects (e.g. the level of aggregations) a lot more extensible. Removing and simplifying TestRunsGenerator allows us to implement such extensions in the future. Also removed the js files that are no longer used. * config.json: Moved from database/config.json. * database/aggregate.js: Removed. No longer used. * database/database-common.js: Removed unused functions, and updated the path to config.json. * database/process-jobs.js: Removed. No longer used. * database/sample-data.sql: Removed. We have a much better corpus of data now. * database/schema.graffle: Removed. It's completely obsolete. * public/include/db.php: Updated the path to config.json. * public/include/evaluator.js: Removed. * public/include/report-processor.php: (TestRunsGenerator::aggregate): Directly aggregate values via newly added aggregate_values method instead of storing values into $expressions and calling evaluate_expressions_by_node. (TestRunsGenerator::aggregate_values): Added. (TestRunsGenerator::compute_caches): Directly compute the caches. 2014-01-30 Ryosuke Niwa Build fix. Don't fail the platform merges even if there are no test configurations to be moved to the new platform. * public/admin/platforms.php: * public/include/db.php: 2014-01-30 Ryosuke Niwa Zoomed y-axis view is ununsable when the last result is an outlier. Reviewed by Stephanie Lewis. Show two standard deviations from the exponential moving average with alpha = 0.3 instead of the mean of the last result so that the graph looks sane if the last result was an outlier. However, always show the last result's mean even if it was an outlier. * public/index.html: * public/js/helper-classes.js: (unscaledMeansForAllResults): Extracted from min/max/sampleStandardDeviation. Also added the ability to cache the unscaled means to avoid recomputation. (PerfTestRuns.min): Refactored to use unscaledMeansForAllResults. (PerfTestRuns.max): Ditto. (PerfTestRuns.sampleStandardDeviation): Ditto. (PerfTestRuns.exponentialMovingArithmeticMean): Added. 2014-01-30 Ryosuke Niwa Minor fixes. * public/admin/tests.php: * public/js/helper-classes.js: 2014-01-29 Ryosuke Niwa Use two standard deviations instead as I mentioned in the mailing list. * public/index.html: 2014-01-28 Ryosuke Niwa The performance dashboard erroneously shows upward arrow for combined metrics. A single outlier can ruin the zoomed y-axis view. Rubber-stamped by Antti Koivisto. * public/index.html: (computeYAxisBoundsToFitLines): Added adjustedMax and adjustedMin, which are pegged at 4 standard deviations from the latest results' mean. (Chart): Renamed shouldStartYAxisAtZero to shouldShowEntireYAxis. (Chart.attachMainPlot): Use the adjusted max and min when we're not showing the entire y-axis. (Chart.toggleYAxis): * public/js/helper-classes.js: (PerfTestRuns.sampleStandardDeviation): Added. (PerfTestRuns.smallerIsBetter): 'Combined' is a smaller is better metric. 2014-01-28 Ryosuke Niwa Don't include the confidence interval when computing the y-axis. Rubber-stamped by Simon Fraser. * public/js/helper-classes.js: (PerfTestRuns.min): (PerfTestRuns.max): 2014-01-25 Ryosuke Niwa Tiny CSS tweak for tooltips. * public/index.html: 2014-01-25 Ryosuke Niwa Remove the erroneously repeated code. * public/admin/test-configurations.php: 2014-01-24 Ryosuke Niwa perf dashboard should show baseline numbers Reviewed by Stephanie Lewis. * public/admin/bug-trackers.php: (associated_repositories): Return an array of HTMLs instead of echo'ing as expected by AdministrativePage. Also fixed a typo. * public/admin/platforms.php: (merge_list): Ditto. * public/admin/test-configurations.php: Added. (add_run): Adds a "synthetic" test run and a corresponding build. It doesn't create run_iterations and build_revisions as they're not meaningful for baseline / target numbers. (delete_run): Deletes a synthetic test run and its build. It verifies that the specified build has exactly one test run so that we don't accidentally delete a reported test run. (generate_rows_for_configurations): Generates rows of configuration IDs and types. (generate_rows_for_test_runs): Ditto for test runs. It also emits the form to add new "synthetic" test runs and delete existing ones. * public/admin/tests.php: We wrongfully assumed there is exactly one test configuration for each metric on each platform; there could be configurations of distinct types such as "current" and "baseline". Thus, update all test configurations for a given metric when updating config_is_in_dashboard. * public/api/runs.php: Remove the NotImplemented when we have multiple test configurations. (fetch_runs_for_config): "Synthetic" test runs created on test-configurations page are missing revision data so we need to left-outer-join (instead of inner-join) build_revisions. To avoid making the query unreadable, don't join revision_repository here. Instead, fetch the list of repositories upfront and resolve names in parse_revisions_array. This actually reduces the query time by ~10%. (parse_revisions_array): Skip an empty array created for "synthetic" test runs. * public/include/admin-header.php: (AdministrativePage::render_table): Now custom columns support sub columns. e.g. a configuration column may have id and type sub columns, and each custom column could generate multiple rows. Any table with sub columns now generates two rows for thead. We generate td's in in the first row without sub columns with rowspan of 2, and generate ones with sub columns with colspan set to the sub column count. We then proceed to generate the second header row with sub column names. When generating the actual content, we first generate all custom columns as they may have multiple rows in which case regular columns need rowspan set to the maximum number of rows. Once we've generated the first row, we proceed to generate subsequent rows for those custom columns that have multiple rows. (AdministrativePage::render_custom_cells): Added. This function is responsible for generating table cells for a given row in a given custom column. It generates an empty td when the custom column doesn't have enough rows. It also generates empty an td when it doesn't have enough columns in some rows except when the entire row consists of exactly one cell for a custom column with sub columns, in which case the cell is expanded to occupy all sub columns. * public/include/manifest.php: (ManifestGenerator::platforms): Don't add the metric more than once. * public/include/test-name-resolver.php: (TestNameResolver::__construct): We had wrongfully assumed that we have exactly one test configuration on each platform for each metric like tests.php. Fixed that. Also fetch the list of aggregators to compute the full metric name later. (TestNameResolver::map_metrics_to_tests): Populate $this->id_to_metric. (TestNameResolver::test_id_for_full_name): Simplified the code using array_get. (TestNameResolver::full_name_for_test): Added. (TestNameResolver::full_name_for_metric): Added. (TestNameResolver::configurations_for_metric_and_platform): Renamed as it returns multiple configurations. * public/js/helper-classes.js: (TestBuild): Use the build time as the maximum time when revision information is missing for "synthetic" test runs created to set baseline and target points. 2014-01-24 Ryosuke Niwa Build fix after r57928. Removed a superfluous close parenthesis. * public/api/runs.php: 2014-01-24 Ryosuke Niwa Unreviewed build & typo fixes. * public/admin/platforms.php: * tests/admin-platforms.js: 2014-01-24 Ryosuke Niwa perf dashboard should show baseline numbers Rubber-stamped by Antti Koivisto. Organize some code into functions in runs.php. Also added back $paths that was erroneously removed in r57925 from json-header.php. * public/api/runs.php: (fetch_runs_for_config): Extracted. (format_run): Ditto. 2014-01-23 Ryosuke Niwa Merge the upstream json-shared.php as of https://trac.webkit.org/r162693. * database/config.json: * public/admin/reprocess-report.php: * public/api/report.php: * public/api/runs.php: * public/include/json-header.php: 2014-01-23 Ryosuke Niwa Commit yet another forgotten change. Something went horribly wrong with my merge :( * database/init-database.sql: 2014-01-23 Ryosuke Niwa Commit one more forgotten change. Sorry for making a mess here. 2014-01-23 Ryosuke Niwa Commit the forgotten files. * public/admin/platforms.php: Added. * tests/admin-platforms.js: Added. 2014-01-23 Ryosuke Niwa SafariPerfMonitor: there should be a way to merge and hide platforms Reviewed by Stephanie Lewis. Added /admin/platforms/ page to hide and merge platforms. Merging two platforms is tricky because we need to migrate test runs as well as some test configurations. Recall that each test (e.g. Dromaeo) can have many "test metrics" (e.g. MaxAllocations, EndAllocations), and they have a distinct "test configuration" for each platform (e.g. MaxAllocation on Mountain Lion), and each test configuration a distinct "test run" for each build. In order to merge platform A into platform B, we must migrate all test runs that belong to platform A via their test configurations into platform B. Suppose we're migrating a test run R for test configuration T_A in platform A for metric M. Since M exists independent of platforms, R should continue to relate to M through some test configuration. Unfortunately, we can't simply move T_A into platform B since we may already have a test configuration T_B for metric M in platform B, in which case R should relate to T_B instead. Thus, we first migrate all test runs for which we already have corresponding test configurations in the new platform. We then migrate the test configurations of the remaining test runs. * database/init-database.sql: Added platform_hidden. * public/admin/platforms.php: Added. (merge_platforms): Added. Implements the algorithm described above. (merge_list): Added. * public/admin/tests.php: Disable the checkbox to show a test configuration on the dashboard if its platform is hidden since it doesn't do anything. * public/include/admin-header.php: Added the hyperlink to /admin/platforms. (update_field): Don't bail out if the newly added "update-column" is set to the field name even if $_POST is missing it since unchecked checkbox doesn't set the value in $_POST. (AdministrativePage::render_form_control_for_column): Added the support for boolean edit mode. Also used switch statement instead of repeated if's. (AdministrativePage::render_table): Emit "update-column" for update_field. * public/include/db.php: Disable warnings when we're not in the debug mode. * public/include/manifest.php: (ManifestGenerator::platforms): Skip platforms that have been hidden. * run-tests.js: (TestEnvironment.postJSON): (TestEnvironment.httpGet): (TestEnvironment.httpPost): Added. (sendHttpRequest): Set the content type if specified. * tests/admin-platforms.js: Added tests. 2014-01-22 Ryosuke Niwa Extract the code to compute full test names from tests.php. Reviewed by Stephanie Lewis. Extracted TestNameResolver out of tests.php. This reduces the number of global variables in tests.php and paves our way to re-use the code in other pages. * public/admin/tests.php: * public/include/db.php: (array_set_default): Renamed from array_item_set_default and moved from tests.php as it's used in both tests.php and test-name-resolver.php. * public/include/test-name-resolver.php: Added. (TestNameResolver::__construct): (TestNameResolver::compute_full_name): Moved from tests.php. (TestNameResolver::map_metrics_to_tests): Ditto. (TestNameResolver::sort_tests_by_full_name): Ditto. (TestNameResolver::tests): Added. (TestNameResolver::test_id_for_full_name): Ditto. (TestNameResolver::metrics_for_test_id): Ditto. (TestNameResolver::child_metrics_for_test_id): Ditto. (TestNameResolver::configuration_for_metric_and_platform): Ditto. 2014-01-21 Ryosuke Niwa Perf dashboard is erroneously associating reported results with old revisions Reviewed by Stephanie Lewis. Add the ability to reprocess reports so that I can re-associate wrongfully associated reports. Added public/admin/reprocess-report.php. It doesn't have any nice UI to find reports and it returns JSON but that's sufficient to correct the wrongfully processed reports for now. * public/admin/reprocess-report.php: Added. Takes a report id in $_GET or $_POST and process the report. We should eventually add a nice UI to find and reprocess reports. * public/api/report.php: ReportProcessor and TestRunsGenerator have been removed. * public/include/db.php: Added the forgotten call to prefixed_column_names. * public/include/report-processor.php: Copied from public/api/report.php. (ReportProcessor::__construct): Fetch the list of aggregators here for simplicity. (ReportProcessor::process): Optionally takes $existing_report_id. When this value is specified, we don't create a new report or authenticate the builder password (the password is never stored in the report). Also use select_first_row instead of query_and_fetch_all to find the builder for simplicity. (ReportProcessor::construct_build_data): Extracted from store_report_and_get_build_data. (ReportProcessor::store_report): Ditto. * tests/admin-reprocess-report.js: Added. 2014-01-21 Ryosuke Niwa Perf dashboard is erroneously associating reported results with old revisions Reviewed by Ricky Mondello. The bug was caused by a build fix r57645. It attempted to treat multiple reports from the same builder for the same build number as a single build by ignoring build time. This was necessary to associate multiple reports by a single build - e.g. for different performance test suites - because the scripts we use to submit results computed its own "build time" when they're called. An unintended consequence of this change was revealed when we moved a buildbot master to the new machine last week; new reports were wrongfully associated with old build numbers. Fixed the bug by not allowing reports made more than 1 day after the initial build time to be assigned to the same build. Instead, we create a new build object for those reports. Since the longest set of tests we have only take a couple of hours to run, 24 hours should be more than enough. * database/init-database.sql: We can no longer constrain that each build number is unique to a builder or that build number and build time pair is unique. Instead, constrain the uniqueness of the tuple (builder, build number, build time). * public/api/report.php: (ReportProcessor::resolve_build_id): Look for any builds made within the past one day. Create a new build when no such build exists. This prevents a report from being associated with a very old build of the same build number. Also check that revision numbers or hashes match when we're adding revision info. This will let us catch a similar bug in the future sooner. * tests/api-report.js: Added three test cases. 2014-01-20 Ryosuke Niwa Merged the upstream changes to db.php See http://trac.webkit.org/browser/trunk/Websites/test-results/public/include/db.php * public/include/db.php: 2014-01-20 Ryosuke Niwa Update other scripts and tests per previous patch. * public/include/manifest.php: * tests/admin-regenerate-manifest.js: 2014-01-20 Ryosuke Niwa Remove metrics_unit. Reviewed by Ricky Mondello. This column is no longer used by the front-end code since r48360. * database/init-database.sql: * public/admin/tests.php: 2014-01-16 Ryosuke Niwa Unreviewed build fix. * public/api/report.php: 2014-01-15 Ryosuke Niwa Automate DoYouEvenBench (124497) Reviewed by Ricky Mondello. Support a new alternative format for aggregated results where we have raw values as well as the list aggregators so that instead of "metrics": {"Time": ["Arithmetic"]} we can have "metrics": {"Time": { "aggregators" : ["Arithmetic"], "current": [300, 310, 320, 330] }} This allows single JSON generated by run-perf-tests in WebKit to be shared between the perf dashboard and the generated results page, which doesn't know how to aggregate values. We need to keep the support for the old format because all other existing performance tests all rely on the old format. Even if we updated the tests, we need the dashboard to support the old format during the transition. * public/api/report.php: (ReportProcessor::recursively_ensure_tests): Support the new format in addition to the old one. (ReportProcessor::aggregator_list_if_exists): Replaced is_list_of_aggregators. * tests/api-report.js: Updated one of aggregator test cases to test the new format. 2013-05-31 Ryosuke Niwa Unreviewed; Tweak the CSS so that chart panes align vertically. * public/index.html: 2013-05-31 Ryosuke Niwa SafariPerfMonitor should support Combined metric. * public/js/helper-classes.js: (PerfTestRuns): Added 'Combined' metric. In general, it could be used for smaller-is-better value as well but assume it to be greater-is-better for now. 2013-05-30 Ryosuke Niwa Commit the forgotten init-database change to add iteration_relative_time. * database/init-database.sql: 2013-05-30 Ryosuke Niwa SafariPerfMonitor: Support accepting (relative time, value) pairs Reviewed by Ricky Mondello. Add the support for each value to have a relative time. This is necessary for frame rate history since a frame rate needs to be associated with a time it was sampled. * database/init-database.sql: Added iteration_relative_time to run_iterations. * public/api/report.php: (TestRunsGenerator::test_value_list_to_values_by_iterations): Reject any non-numeral values here. This code is used to aggregate values but it doesn't make sense to aggregate iteration values with relative time since taking the average of two frame rates for two subtests taken at two different times doesn't make any sense. (TestRunsGenerator::compute_caches): When we encounter an array value while computing sum, mean, etc..., use the second element since we assume values are of the form (relative time, frame rate). Also exit early with an error if the number of elements in the array is not a pair. (TestRunsGenerator::commit): Store the relative time and the frame rate as needed. * tests/api-report.js: Added a test case. Also modified existing test cases to account for iteration_relative_time. 2013-05-27 Ryosuke Niwa SafariPerfMonitor: Support accepting single-value results Reviewed by Ricky Mondello. Support that. It's one line change. * public/api/report.php: (ReportProcessor.recursively_ensure_tests): When there is exactly one value, wrap it inside an array to match the convention assumed elsewhere. * tests/api-report.js: Added a test case. 2013-05-26 Ryosuke Niwa SafariPerfMonitor shows popups for points outside of the visible region. Rubber-stamped by Simon Fraser. * public/index.html: (Chart.closestItemForPageXRespectingPlotOffset): renamed from closestItemForPageX. (Chart.attach): Always use closestItemForPageXRespectingPlotOffset to work around the fact flot may return an item underneath y-axis labels. 2013-05-26 Ryosuke Niwa Tweak the CSS a little to avoid the test name overlapping with the summary table. * public/index.html: 2013-05-26 Ryosuke Niwa Unreviewed. Fix the typo. The anchor element should wrap the svg element, not the other way around. * public/index.html: 2013-05-26 Ryosuke Niwa Should be a toggle to show entire Y-axis range Should scale Y axis to include error ranges Reviewed by Ricky Mondello. Add the feature. Also made adjust y-axis respect confidence interval delta so that the gray shade behind the main graph doesn't go outside the graph even when the y-axis is adjusted. * database/config.json: * public/index.html: (Chart): Add a SVG arrow to toggle y-axis mode, and bind click on the arrow to toggleYAxis(). (Chart.attachMainPlot): Respect shouldStartYAxisAtZero. (Chart.toggleYAxis): Toggle the y-axis mode of this chart by toggling shouldStartYAxisAtZero and calling attachMainPlot. * public/js/helper-classes.js: (PerfTestResult.confidenceIntervalDelta): (PerfTestResult.unscaledConfidenceIntervalDelta): Extracted. (PerfTestRuns.min): Take confidence interval delta into account. (PerfTestRuns.max): Ditto. (PerfTestRuns.hasConfidenceInterval): Not sure why this function was checking the typeof. Just use isNaN. 2013-04-26 Ryosuke Niwa A build fix of the previous. Don't look for a test with NULL parent because NULL != NULL in our beloved SQL. * public/api/report.php: (ReportProcessor::recursively_ensure_tests): * tests/api-report.js: Added a test. 2013-04-26 Ryosuke Niwa Unreviewed build fixes. * public/api/report.php: (ReportProcessor::process): Explicitly exit with error when builder name or build time is missing. Also, tolerate reports without any revision information. (ReportProcessor::recursively_ensure_tests): When looking for a test, don't forget to compare its parent test. * tests/api-report.js: Added few test cases. 2013-04-26 Ryosuke Niwa Commit another change that was supposed to be committed in r50331. * run-tests.js: (TestEnvironment.this.postJSON): (TestEnvironment.this.httpGet): (sendHttpRequest): 2013-04-09 Ryosuke Niwa Commit the remaining files. * public/admin/regenerate-manifest.php: * public/include/admin-header.php: * public/include/json-header.php: * public/include/manifest.php: * run-tests.js: (TestEnvironment.this.postJSON): (TestEnvironment.this.httpGet): (sendHttpRequest): 2013-03-15 Ryosuke Niwa SafariPerfMonitor: Add some tests for admin/regenerate-manifest. Reviewed by Ricky Mondello. Added some tests for admin/regenerate-manifest. * public/admin/regenerate-manifest.php: Use require_once instead of require. * public/include/admin-header.php: Ditto. * public/include/json-header.php: Ditto. * public/include/manifest.php: (ManifestGenerator::builders): Removed a reference to a non-existent variable. When there are no builders, simply return an empty array. * run-tests.js: (TestEnvironment.postJSON): (TestEnvironment.httpGet): Added. (sendHttpRequest): Renamed from postHttpRequest as it now takes method as an argument. * tests/admin-regenerate-manifest.js: Added with a bunch of test cases. 2013-03-14 Ryosuke Niwa Unreviewed. Added more tests for api/report to ensure it creates tests, metrics, test_runs, and run_iterations. Also fixed a typo in report.php found by new tests. * public/api/report.php: (main): Fix a bug in the regular expression to wrap numbers with double quotations. * tests/api-report.js: Added more test cases. 2013-03-12 Ryosuke Niwa SafariPerfMonitor: Need integration tests Reviewed by Ricky Mondello. Add a test runner script and some simple test cases. * database/config.json: Added the configuration for "testServer". * database/database-common.js: (pathToTests): Added. * run-tests.js: Added. (main): (confirmUserWantsDatabaseToBeInitializedIfNeeded): Checks whether there are any non-empty tables, and if there are, asks the user if it’s okay to delete all of the data contained therein. (confirmUserWantsDatabaseToBeInitializedIfNeeded.findNonEmptyTable): Find a table with non-zero number of rows. (confirmUserWantsDatabaseToBeInitializedIfNeeded.fetchTableNames): Fetch the list of all tables in the current database using PostgreSQL's information_schema. (askYesOrNoQuestion): (initializeDatabase): Executes init-database.sql. It drops all tables and creates them again. (TestEnvironment): The global object exposed in tests. Provides various utility functions. (TestEnvironment.assert): Exposes assert to tests. (TestEnvironment.console): Exposes console to tests. (TestEnvironment.describe): Adds a description. (TestEnvironment.it): Adds a test case. (TestEnvironment.postJSON): (TestEnvironment.queryAndFetchAll): (TestEnvironment.sha256): (TestEnvironment.notifyDone): Ends the current test case. (postHttpRequest): (TestContext): An object created for each test case. Conceptually, this object is always on "stack" when a test case is running. TestEnvironment and an uncaughtException handler accesses this object via currentTestContext. (TestContext.description): (TestContext.done): (TestContext.logError): * tests: Added. * tests/api-report.js: Added some basic tests for /api/report.php. 2013-03-08 Ryosuke Niwa Unreviewed administrative page fix. Make it possible to remove all configuration from dashboard. The problem was that we were detecting whether we're updating dashboard or not by checking the existence of metric_configurations in $_POST but this key doesn't exist when we're removing all configurations. Use separate 'dashboard' action to execute the code even when metric_configurations is empty. * public/admin/tests.php: 2013-03-08 Ryosuke Niwa SafariPerfMonitor: Extract a class to aggregate and store values from ReportProcessor. Reviewed by Ricky Mondello. This patch extracts TestRunsGenerator, which aggregates and compute caches of values, from ReportProcessor as a preparation to replace deprecated aggregate.js. * public/api/report.php: (ReportProcessor::exit_with_error): Moved. (ReportProcessor::process): Use the extracted TestRunsGenerator. (TestRunsGenerator): Added. (TestRunsGenerator::exit_with_error): Copied from ReportProcessor. (TestRunsGenerator::add_aggregated_metric): Moved. (TestRunsGenerator::add_values_for_aggregation): Moved. Made public. (TestRunsGenerator::aggregate): Moved. Made public. (TestRunsGenerator::aggregate_current_test_level): Moved. (TestRunsGenerator::test_value_list_to_values_by_iterations): Moved. (TestRunsGenerator::evaluate_expressions_by_node): Moved. (TestRunsGenerator::compute_caches): Moved. Made public. (TestRunsGenerator::add_values_to_commit): Moved. Made public. (TestRunsGenerator::commit): Moved. Made public. Also takes build_id and platform_id. (TestRunsGenerator::rollback_with_error): Moved. 2013-03-08 Ryosuke Niwa SafariPerfMonitor: Administrative pages should update manifest JSON as needed. Reviewed by Remy Demarest. Regenerate the manifest file when updating fields or adding new items that are included in the manifest JSON. * public/admin/bug-trackers.php: * public/admin/builders.php: * public/admin/regenerate-manifest.php: * public/admin/repositories.php: * public/admin/tests.php: * public/include/admin-header.php: (regenerate_manifest): Extracted from regenerate-manifest.php. 2013-03-08 Ryosuke Niwa Unreviewed build fix for memory test results. Make aggregation work in the nested cases. We start from the "leaf" tests and move our ways up, aggregating at each level. * public/api/report.php: (ReportProcessor::recursively_ensure_tests): (ReportProcessor::add_aggregated_metric): Renamed from ensure_aggregated_metric. (ReportProcessor::add_values_for_aggregation): (ReportProcessor::aggregate): (ReportProcessor::aggregate_current_test_level): Extracted from aggregate. 2013-03-02 Ryosuke Niwa Build fixes. iteration_count_cache should be the total number of values in all iteration group, not the number of iteration groups. Also, don't set group number when the entire run belongs a single iteration group. * public/api/report.php: (ReportProcessor::commit): 2013-03-01 Ryosuke Niwa SafariPerfMonitor: Introduce iteration groups Reviewed by Remy Demarest. In WebKit land, we're going to use multiple instances of DumpRenderTree or WebKitTestRunner to amortize the runtime environment variances to get more stable results. And it's desirable to keep track of the instance of DumpRenderTree or WebKitTestRunner used to generate each iteration value. This patch introduces "iteration groups" to keep track of this extra information. Instead of receiving a flat array of iteration values, we can now receive a two dimensional array where the outer array denotes iteration groups and each inner array contains iteration values for each group. * database/init-database.sql: Add iteration_group column. * public/api/report.php: (ReportProcessor::recursively_ensure_tests): Always use the two dimensional array internally. (ReportProcessor::aggregate): test_value_list_to_values_by_iterations now returns an associative array contains the list of values indexed by the iteration order and group sizes. Store the group size so that we can restore the iteration groups before passing it to node.js and restore them later. (ReportProcessor::test_value_list_to_values_by_iterations): Flatten iteration groups into an array of values and construct group_size array to restore the groups later in ReportProcessor::aggregate. Also check that each iteration group in each subtest are consistent with one another. To see why we need to do this, suppose we're aggregating two tests T1 and T2 with the following values. Then it's important that each iteration group in T1 and T2 have the same size: T1 = [[1, 2], [3, 4, 5]] T2 = [[6, 7], [8, 9, 10]] so that the aggregated result (the sum in this case) can have the same groups as in: T = [[7, 9], [11, 13, 15]] If some iteration groups in T1 and T2 had a different size as in: T1 = [[1, 2, 3], [4, 5]] T2 = [[6, 7], [8, 9, 10]] Then iteration groups of the aggregated T is ambiguous. (ReportProcessor::compute_caches): Flatten iteration groups to compute caches (e.g. mean, stdev, etc...) (ReportProcessor::commit): Store iteration_group values. 2013-03-01 Ryosuke Niwa Unreviewed. Delete the migration tool for webkit-perf.appspot.com now that we have successfully migrated to perf.webkit.org. * database/perf-webkit-migrator.js: Removed. 2013-03-01 Ryosuke Niwa Build fix. Don't forget to add metrics of the top level tests e.g. Dromaeo:Time:Arithmetic. * public/index.html: (.showCharts): 2013-03-01 Ryosuke Niwa SafariPerfMonitor: Make it possible to add charts for all subtests or all platforms. Reviewed by Ricky Mondello. It is often desirable to see charts of a given test for all platforms, or to be able to see charts of all subtests on a given platform when trying to triage perf. regressions. Support this use case by adding the ability to do so on the charts page. Also, we used to disable items on the test list based on the platform chosen. This turned out to be a bad UI because in many situations you want to be able to compare results of the same test on multiple platforms. In this new UI, we have three select elements, each of which selects the following: 1. Top-level test - Test suite such as Dromaeo 2. Metric - Pages and subtests under the suite such as www.webkit.org for dom-modify:Runs (where dom-modify is the name of the subtest and Runs is a metric in that subtest) for Dromaeo. 3. Platform - Mountain Lion, Qt, etc... A user can select "all" for metric and platform but we disallow doing both at once since adding all metrics on all platforms tends to add way too many charts and hang the browser. I also can't think of a use case where you want to look at that many charts at once. We can support this later if valid use cases come up. * public/index.html: (.showCharts.addOption): Extracted. (.showCharts): Added "metricList" that shows the list of test and metrics (in the form of relative metrics paths such as "DOMWalk:Time") for each top-level test selected in testList. metricList has onchange handler that enables/disables items on platformList. (init): Sort tests and test metrics here instead of doing that in showCharts. 2013-02-28 Ryosuke Niwa SafariPerfMonitor: tooltip should include a link to build URLs Reviewed by Remy Demarest and Ricky Mondello. Added a hyperlink to build page in tooltips. Repeating the entire build URL in each build was a bad idea because it bloats the resultant JSON file too much. So move the build URL templates to the manifest file instead. Each build now only contains the builder id. * public/api/runs.php: Removed the part of the query that joined builders table. This speeds up the query quite a bit. * public/include/manifest.php: (ManifestGenerator::generate): Generate builders field. (ManifestGenerator::builders): Added. Returns an associative array of builder ids to an associative array that contains name and its build URL template. * public/index.html: (.buildLabelWithLinks.linkifyIfNotNull): Renamed from linkifiedLabel. Take a label and url instead of a revision since this function is used for revisions and build page URLs now. (.buildLabelWithLinks): Include the linkified build number. * public/js/helper-classes.js: (TestBuild.builder): Added. (TestBuild.buildNumber): Added. (TestBuild.buildUrl): Returns the build URL. The variable name in the URL template has been changed from %s to $buildNumber to be more descriptive and consistent with other URL templates. 2013-02-27 Ryosuke Niwa Tooltips interfere with user interactions Rubber-stamped by Simon Fraser. Disable tooltip on the dashboard page since graphs are too small to be useful there. Also, show graphs for only 10 days by default as opposed to 20. Finally, dismiss the hovering tooltip when mouse enters a "pinned" tooltip. * public/index.html: * public/js/helper-classes.js: 2013-02-24 Ryosuke Niwa Fix some serious typo. We're supposed to be using SHA-256, not SHA-1 to hash our passwords, to be compatible with webkit-perf.appspot.com. * public/admin/builders.php: * public/api/report.php: 2013-02-23 Ryosuke Niwa Unreviewed. Add a missing constraint on builds table. For a given builder, there should be exactly one build for a given build number. Also add report_committed_at to reports table to record the time at which a given report was processed and test_runs and run_iterations rows were committed into the database. * database/config.json: * public/api/report.php: 2013-02-22 Ryosuke Niwa Unreviewed. Add more checks for empty SQL query results. * public/include/manifest.php: 2013-02-21 Ryosuke Niwa More build fixes on perf.webkit.org. * public/api/runs.php: Make PostgreSQL happier. * public/include/manifest.php: Don't assume we always have bug trackers. 2013-02-21 Ryosuke Niwa SafariPerfMonitor: index.html duplicates the code in PerfTestRuns to determine smallerIsBetter and fix other miscellaneous UI bugs. Rubber-stamped by Simon Fraser. Removed the code to determine whether smaller value is better or not for a given test in index.html in the favor of using that of PerfTestRuns. * public/include/manifest.php: Fixed a typo. * public/index.html: (Chart): (Chart.attachMainPlot): Fixed a bug to access previousPoint.left even when previousPoint is null. * public/js/helper-classes.js: (PerfTestRuns): Added EndAllocations, MaxAllocations, and MeanAllocations. (PerfTestRuns.computeScalingFactorIfNeeded): When the mean is almost 10,000 units, we may end up using 5 digits instead of 4, resulting in the use of scientific notations. Go up to the next unit at roughly 2,000 units to avoid this. (Tooltip.show): Show the tooltip even when the new content is identical to the previous content. The only thing we can avoid is innerHTML. 2013-02-21 Ryosuke Niwa Another build fix. The path to node is /usr/local/bin/node, not /usr/bin/local/node * public/include/evaluator.js: 2013-02-21 Ryosuke Niwa SafariPerfMonitor: Bug trackers should be configurable Reviewed by Remy Demarest. Made the list of bug trackers configurable. Namely, each bug tracker can be added in admin/bug-trackers.php and can be associated with multiple repositories. The association between bug trackers and repositories (such as WebKit, Safari, etc...) are used to determine the set of bug trackers to show for a given set of blame lists. e.g. if a test regressed due to a change in Safari, then we don't want to show WebKit Bugzilla as a place to file bugs against the regression. F * database/init-database.sql: Added bug_trackers and tracker_repositories. Also drop those tables before creating them (note "DROP TABLE reports" was missing). * public/admin/bug-trackers.php: Added. The administrative interface for adding and managing bug trackers, namely associated repositories. * public/include/admin-header.php: Added a link to bug-trackers.php * public/include/manifest.php: (ManifestGenerator::generate): Include the list of bug trackers in the manifest. Also moved the code to fetch repositories table here from ManifestGenerator::repositories. (ManifestGenerator::repositories): (ManifestGenerator::bug_trackers): Added. Generates an associative array of bug trackers where keys are names of bug trackers and values are associative arrays with keys 'new_bug_url' and 'repositories' where the latter contains the list of associated repository names. * public/index.html: (Chart): Takes bugTrackers as as argument. (Chart.showTooltipWithResults): Removed the hard-coded list. (init): (init.addPlatformsToDashboard): (init.showCharts.createChartFromListPair): (init): Stores the list of bug trackers in the manifest to a local variable. 2013-02-21 Ryosuke Niwa A follow up on the previous build fix. When using proc_open, we need to make evalulator.js executable. * public/include/evaluator.js: 2013-02-21 Ryosuke Niwa SafariPerfMonitor: Extract the code to generate tabular view in administrative pages Reviewed by Remy Demarest. Extracted AdministrativePage to share the code to generate a tabular view of data and a form to insert new row into the database. * public/admin/aggregators.php: Use AdministrativePage. * public/admin/builders.php: Ditto. * public/admin/repositories.php: Ditto. * public/include/admin-header.php: (AdministrativePage): Added. (AdministrativePage::__construct): column_info is an associative array that maps a SQL column name to an associative array that describes the column. - editing_mode: Specifies the type of form ('text', 'url', or 'string') to show for this column. - label: Human readable name of the column. - pre_insertion: Signifies that this column exists only before the row is inserted. e.g. password column exists only before we create password_hash column at the insertion time. (AdministrativePage::name_to_titlecase): Converts an underscored lowercase name to a human readable titlecase (e.g. new_bug is converted to New Bug). (AdministrativePage::column_label): Obtains the label specified in column_info or titlecased column name. (AdministrativePage::render_form_control_for_column): "Renders" a text form control such as input and textarea for a given editing mode ('text', 'url', or 'string'). (AdministrativePage::render_table): Renders a whole SQL table after sorting rows by the specified column. (AdministrativePage::render_form_to_add): Renders a form to insert new row. 2013-02-20 Ryosuke Niwa Build fix. Some systems don't support r+. Use proc_open instead. * public/api/report.php: 2013-02-15 Ryosuke Niwa Build fix. Use the mean data series as supposed to upper or lower confidence bounds when computing the y-axis of data points to show tooltips at. * public/index.html: 2013-02-15 Ryosuke Niwa Unreviewed. Removed .htaccess in favor of directly putting directives in httpd.conf. * Install.md: * public/.htaccess: Removed. 2013-02-14 Ryosuke Niwa Unreviewed. * public/include/manifest.php: Build fix. db is on this. * public/js/statistics.js: (Statistics.confidenceInterval): Added. An utility function for debugging purposes. 2013-02-13 Ryosuke Niwa SafariPerfMonitor doesn't work on perf.webkit.org (Part 2) Reviewed by Anders Carlsson. Rewrote and merged populate-from-report.js into report.php. * database/config.json: Added a path to node.js. * database/init-database.sql: Don't require unit to be always present since it's no longer used by the front end. Once we land this patch and update the administrative pages, we can remove this column. Also add a new reports table to store JSON reported by builders. We used to store everything in jobs table but that table is going away once we remove the node.js backend. * database/populate-from-report.js: Removed. * public/api/report.php: Added. (ReportProcessor): (ReportProcessor.__construct): (ReportProcessor.process): (ReportProcessor.store_report_and_get_build_data): We store the report into the database as soon as it has been verified to be submitted by a known builder. (ReportProcessor.exit_with_error): Store the error message and details in the database if the report had been stored. If not, then notify that to the client via 'failureStored' in the JSON response. (ReportProcessor.resolve_build_id): Insert build and build_revisions rows if needed. We don't do this atomically inside a transaction because there could be multiple reports for a single build, each containing results for different tests. (ReportProcessor.recursively_ensure_tests): Parse a tree of tests and insert tests and test_metrics rows as needed. It also computes the metrics to aggregate and prepares values to commit via ensure_aggregated_metric, add_values_to_commit, and add_values_for_aggregation. (ReportProcessor.is_list_of_aggregators): When a metric is an aggregation, it contains an array of aggregator names, e.g. ["Arithmetic", "Geometric"], instead of a dictionary of configuration types to their values, e.g. {Time: {current: [1, 2, 3,]}}. This function detects the former. (Note that dictionary and list are both array's in PHP). (ReportProcessor.ensure_aggregated_metric): Create a metric with aggregator to add it to the list of metrics to be aggregated in ReportProcessor.aggregate. (ReportProcessor.add_values_for_aggregation): Called by test metrics with aggregated parent test metrics. (ReportProcessor.aggregate): Compute results for aggregated metrics. Consider a matrix with rows representing child tests and columns representing "iterations" for a given aggregated metrics M. Initially, we have values given for each row (child metrics of M). This function extracts each column (iteration) via test_value_list_to_values_by_iterations, and feeds it into evaluate_expressions_by_node to get aggregated values for each column (iteration of M). Finally, it registers those aggregated values to be committed. Note that we don't want to start a new node.js process for each aggregation, so we accumulate all values to be aggregated in node.js in $expressions. Each entry in $expressions is a JSON string that contains code and values to be aggregated. node.js gives us back a list of JSON strings that contain aggregated values. (ReportProcessor.test_value_list_to_values_by_iterations): See above. (ReportProcessor.evaluate_expressions_by_node): See above. (ReportProcessor.compute_caches): Compute cached mean, sum, and square sums for each run we're about to add using evaluate_expressions_by_node. We can't do this before computing aggregated results since those aggregated results also need the said caches. (ReportProcessor.add_values_to_commit): (ReportProcessor.commit): Add test_runs and run_iterations atomically inside a transaction, rolling back the transaction as needed if anything goes wrong. (ReportProcessor.rollback_with_error) (main): * public/include/db.php: (Database.prepare_params): Use $values (instead of $placeholders) to compute the current index since placeholders ($1, $2, etc...) may be split up into multiple arrays given they may not necessarily show up contiguously in a SQL statement. (Database.select_or_insert_row): Added. Selects a row if the attempt to insert the same row fails. It automatically creates a query string from a dictionary of unprefixed column names and table. It returns a column value of the choice. (Database.begin_transaction): Added. (Database.commit_transaction): Added. (Database.rollback_transaction): Added. * public/include/evaluator.js: Added. * public/include/json-header.php: (exit_with_error): Take error details and merge it with "additional details". This allows report.php to provide context under which the request failed. (successful_exit): Merge "additional details". (set_exit_detail): Added. Sets "additional details" to the JSON returned by exit_with_error or successful_exit. (merge_additional_details): 2013-02-12 Ryosuke Niwa SafariPerfMonitor: Add more helper functions to db.php Reviewed by Remy Demarest. Added Database::insert_row and array_get to make common database operations easier. * public/admin/aggregators.php: Use Database::insert_row instead of execute_query_and_expect_one_row_to_be_affected. * public/admin/builders.php: Ditto. * public/admin/tests.php: Ditto; We used to run a separate SELECT query just to get the id after inserting a row. With insert_row, we don't need that. * public/include/admin-header.php: Ditto. * public/include/db.php: (array_get): Added. It returns the value of an array given a key if the key exists; otherwise return the default value (defaults to NULL) if the key doesn't exist. (Database::column_names): Added. Prefixes an array of column names and creates a comma separated list of the names. (Database::prepare_params): Added. Takes an associative array of column names and their values, and builds up arrays for placeholder (e.g. $1, $2, etc...) and values, then returns an array of column names all in the same order. (Database::insert_row): Added. Inserts a new row into the specified table where column names have the given prefix. Values are given in a form of an associative array where keys are unprefixed column names and values are corresponding values. When the row is successfully inserted, it returns the specified column's value (defaults to prefix_id). If NULL is specified, it returns a boolean indicating the success of the insertion. 2013-02-11 Ryosuke Niwa SafariPerfMonitor doesn't work on perf.webkit.org (Part 1) Reviewed by Conrad Shultz. Rewrote the manifest generator in PHP. * database/generate-manifest.js: Removed. * public/admin/regenerate-manifest.php: Added. Use ManifestGenerator to generate and store the manifest. * public/include/db.php: (array_ensure_item_has_array): Added. * public/include/evaluator.js: Added. * public/include/json-header.php: * public/include/manifest.php: Added. 2013-02-11 Ryosuke Niwa Dates on overflow plot are overlapping Rubber-stamped by Simon Fraser. Don't show more than 5 days. * public/index.html: * public/js/helper-classes.js: (TestBuild.UTCtoPST): (TestBuild.now): 2013-02-07 Ryosuke Niwa Show build time as well as commit time on the dashboard and tooltips. Rubber-stamped by Simon Fraser. Include both the maximum commit time and build time in buildLabelWithLinks. Also use ISO format to save the screen real estate. * public/index.html: (buildLabelWithLinks): * public/js/helper-classes.js: (TestBuild): (TestBuild.buildTime): (TestBuild.formattedBuildTime): 2013-02-08 Ryosuke Niwa Unreviewed; Convert metric.name to metric.unit in the front end. * public/js/helper-classes.js: 2013-02-07 Ryosuke Niwa SafariPerfMonitor: Need hyperlinks to file bugs Rubber-stamped by Simon Fraser. This patch adds hyperlinks to file new bugs on Radar and WebKit Bugzilla. Because we want to include information such as the degree of progression or regression and the regression ranges when filing new bugs, broke various label() functions into smaller pieces to be used in both generating tooltips and the hyperlinks. * public/index.html: (.buildLabelWithLinks): Extracted from TestBuild.label. (.showTooltipWithResults): Extracted from Tooltip.show. Also added the code to generate hyperlinks to file new bugs on Radar and WebKit Bugzilla. * public/js/helper-classes.js: (PerfTestResult.metric): Replaced test() as runs.test() no longer exists. (PerfTestResult.isBetterThan): Added. (PerfTestResult.formattedRelativeDifference): Extracted from PerfTestResult.label. (PerfTestResult.formattedProgressionOrRegression): Ditto. Also use "better" and "worse" instead of arrow symbols to indicate progressions or regressions. (PerfTestResult.label): (TestBuild.formattedTime): Added. (TestBuild.platform): Added. (TestBuild.formattedRevisions): Extracted from TestBuild.label. Merged a part of linkifyLabel. (TestBuild.smallerIsBetter): Added. (Tooltip.show): Take a raw markup instead of two results. 2013-02-06 Ryosuke Niwa SafariPerfMonitor: Dashboard can cause excessive horizontal scrolling when there are many platforms Rubber-stamped by Tim Horton. Stack platforms when there are more than 3 of them since making the layout adaptive is tricky since each platform may have a different number of tests to be shown on the dashboard. * public/index.html: 2013-02-05 Ryosuke Niwa Build fix. Don't prefix a SVn revision with 'r' when constructing a changeset / blame URL. * public/js/helper-classes.js: (TestBuild.label): 2013-02-05 Ryosuke Niwa SafariPerfMonitor: repository names or revisions are double-quoted when they contain a space Rubber-stamped by Tim Horton. The bug was in the PHP code that parsed Postgres array. Trim double quotations as needed. Also fixed a bug in TestBuild where we used to show the revision range as r1234-1250 when the revision r1234 was the revision used in the previous build. * public/api/runs.php: (parse_revisions_array): Trim double quotations around repository names and revisions. * public/js/helper-classes.js: (TestBuild.label): 2013-02-05 Ryosuke Niwa SafariPerfMonitor: Tooltip is unusable Rubber-stamped by Tim Horton. * public/index.html: (Chart.attachMainPlot): Disable auto highlighting (circle around a data point that shows up on hover) on the dashboard page as it's way too noisy. (Chart.hideTooltip): Added. Hides the tooltip that shows up on hover. (.toggleClickTooltip): Extracted from the code for "mouseout" bind (now replaced by "mouseleave"). Pins or unpins a tooltip. When pinning a tooltip, we create a tooltip behind the scene and show that so that the tooltip for hover can be reused further. (.closestItemForPageX): Find the closest item given pageX. We iterate data points from left to right, and find the first point that lies on the right of the cursor position. We then compute the midpoint between this and the previous point and pick the closer of the two. It returns an item-like object that has all properties we need since flot doesn't provide an API to retrieve the real item object. (Chart): Call toggleClickTooltip when a (hover) tooltip is clicked. (Chart.attach): In "plothover" bind, call closestItemForPageX when item is not provided by flot on the first or "current" data points (as opposed to target or baseline data points). Also bind the code to clear crosshair and hide tooltips to "mouseleave" instead of "mouseout", and avoid triggering this code when the cursor is still within the plot's rectangle (e.g. when a cursor moves onto a tooltip) to avoid the premature dismissal of a tooltip. * public/js/helper-classes.js: (Tooltip.ensureContainer): Don't automatically close then the user clicks on tooltip. Delegate this work to the client via bindClick. (Tooltip.show): Move tooltip up by 5px. Also added a FIXME to move this offset computation to the client. (Tooltip.bindClick): Added. 2013-02-03 Ryosuke Niwa Yet another build fix. metricId*s*. * public/admin/tests.php: 2013-02-03 Ryosuke Niwa Another build fix. Use the new payload format for the aggregate job. * public/admin/tests.php: 2013-02-03 Ryosuke Niwa Build fixes. * database/aggregate.js: Use variables that actually exist. * database/database-common.js: (ensureConfigurationIdFromList): Add the newly added configuration to the list so that subsequent function calls will find this configuration. 2013-01-31 Ryosuke Niwa SafariPerfMonitor: Add ReadMe Reviewed by Ricky Mondello. Turned InstallManual into a proper markdown document and added ReadMe.md. * InstallManual: Removed. * InstallManual.md: Moved from InstallManual. * ReadMe.md: Added. 2013-01-31 Ryosuke Niwa SafariPerfMonitor: Add baseline and target lines Reviewed by Ricky Mondello. This patch prepares the front end code to process baseline and target results properly. * public/index.html: (fetchTest.createRunAndResults): Extracted. (fetchTest): Call createRunAndResults on current, baseline, and target values of the JSON. Deleted the comment about how sorting will be unnecessary once we start results in the server side since sorting by the maximum revision commit time turned out to be non-trivial in php. 2013-01-29 Ryosuke Niwa SafariPerfMonitor: Use newer version of flot that supports timezone properly Reviewed by Tim Horton. Use flot at https://github.com/flot/flot/commit/ec168da2cb8619ebf59c7e721d12c44a7960ff41. These files are "dynamically linked" to our app. * public/index.html: * public/js/jquery-1.8.2.min.js: Removed. * public/js/jquery.colorhelpers.js: Added. * public/js/jquery.flot.categories.js: Added. * public/js/jquery.flot.crosshair.js: Added. * public/js/jquery.flot.errorbars.js: Added. * public/js/jquery.flot.fillbetween.js: Added. * public/js/jquery.flot.js: Added. * public/js/jquery.flot.min.js: Removed. * public/js/jquery.flot.navigate.js: Added. * public/js/jquery.flot.resize.js: Added. * public/js/jquery.flot.selection.js: Added. * public/js/jquery.flot.stack.js: Added. * public/js/jquery.flot.symbol.js: Added. * public/js/jquery.flot.threshold.js: Added. * public/js/jquery.flot.time.js: Added. * public/js/jquery.js: Added. 2013-01-29 Ryosuke Niwa Return NaN instead of throwing when there aren't enough samples. Reviewed by Sam Weinig. It's better to return NaN when we don't have enough samples so that we can treat it as if we don't have any confidence interval. * public/js/statistics.js: (Statistics.new): 2013-01-28 Ryosuke Niwa Build fix. Apparently Safari sometimes appends / at the end of hash location. Remove that. * public/js/helper-classes.js: (URLState.parseIfNeeded): 2013-01-28 Ryosuke Niwa SafariPerfMonitor: Always use parameterized SQL functions in php code Reviewed by Ricky Mondello. Parameterized execute_query_and_expect_one_row_to_be_affected and updated the code accordingly. * public/admin/aggregators.php: Use heredoc. * public/admin/builders.php: * public/admin/jobs.php: * public/admin/repositories.php: * public/admin/tests.php: Updated the forms to use unprefixed field names to match other pages. This allows us to use update_field when updating test's url and metric's unit. Changed the action to regenerate aggregated matrix from "update" to "add" to simplify the dependencies in if-else. Also removed a stray code to update unit and url simultaneously since it's never used. * public/include/admin-header.php: (execute_query_and_expect_one_row_to_be_affected): Added $params. Also automatically convert empty strings to NULL as it was previously done via $db->quote_string_or_null_if_empty in callers. (update_field): Moved from repositories.php. (add_job): * public/include/db.php: (quote_string_or_null_if_empty): Removed now that nobody uses this function. 2013-01-25 Ryosuke Niwa Build fixes. Treat mean, sum, and square sum as float, not int. Also use 95% confidence interval instead of 90% confidence interval. * public/api/runs.php: * public/js/helper-classes.js: (.this.confidenceIntervalDelta): 2013-01-24 Ryosuke Niwa Add an administrative page to edit repository information. Reviewed by Ricky Mondello. * public/admin/repositories.php: Added. * public/include/admin-header.php: 2013-01-23 Ryosuke Niwa SafariPerfMonitor: Automatically create aggregated metrics from builder reports Reviewed by Ricky Mondello. Auto-create aggregated matrix such as arithmetic means and geometric means as requested and add a job to aggregate results for those matrix in populate-from-report.js. * database/generate-manifest.js: (.): Include aggregator names such as Arithmetic and Geometric in the list of metrics. * database/init-database.sql: Remove an erroneous unique constraint. There could be multiple matrix that share the same test and name (e.g. Dromaeo, Time) with different aggregators (e.g. Arithmetic and Geometric). * database/populate-from-report.js: (main): (getReport): No change even though the diff looks as if it moved. (processReport): Extracted from main. Fetch the list of aggregators, pass that to recursivelyEnsureTestsIdsAndMetricsIds to obtain the list of aggregated metrics (such as arithmetic means) that need to be passed to aggregate.js (scheduleJobs): Extracted from processReport. Add a job to aggregate results. (recursivelyEnsureTestsIdsAndMetricsIds): When a metric is a list of names, assume them as aggregator names, and add corresponding metrics for them. Note we convert those names to ids using the dictionary we obtained in processReport. (ensureMetricId): Take an aggregator id as an argument. * database/process-jobs.js: Support multiple metric ids and build id. Note that aggregate.js aggregates results for all builds when the build id is not specified. * public/admin/tests.php: * public/index.html: Include the aggregator name in the full name since there could be multiple metrics of the same name with different aggregators. 2013-01-22 Ryosuke Niwa Build fix. Don't pass in arguments to in the wrong order. * database/aggregate.js: 2013-01-21 Ryosuke Niwa SafariPerfMonitor: x-axis is messed up Reviewed by Ricky Mondello. Since the version of flot we use doesn't support showing graphs in the current locate or in a specific timezone, convert all timestamps to PST manually (Date's constructor will still treat them as in UTC). We don't want to use the current locate because other websites on webkit.org assume PST. Also append this information to build's label. * public/js/helper-classes.js: (TestBuild): (TestBuild.label): 2013-01-21 Ryosuke Niwa Store test URLs reported by builders. Reviewed by Ricky Mondello. * database/populate-from-report.js: (recursivelyEnsureTestsIdsAndMetricsIds): Pass in the test url. (ensureTestId): Store the URL. 2013-01-20 Ryosuke Niwa Yet another build fix; don't blow up even if we didn't have any test configurations. * public/admin/tests.php: 2013-01-21 Ryosuke Niwa Build fix; don't instantiate Date when a timestamp wasn't provided. * database/populate-from-report.js: 2013-01-18 Ryosuke Niwa Rename SafariPerfDashboard to SafariPerfMonitor and add a install manual. Reviewed by Tim Horton. Added an install manual. * InstallManual: Added. 2012-12-21 Ryosuke Niwa Minor build fix. Don't unset builderPassword when it's not set. * public/api/report.php: 2012-12-18 Ryosuke Niwa Prettify JSON payloads and make very large payloads not explode the table in jobs.php. Reviewed by Ricky Mondello. * public/admin/admin.css: Make a very large payload scrollable. * public/admin/jobs.php: Format JSONs. 2012-12-19 Ryosuke Niwa SafariPerfMonitor: Add ability to report results from bots Reviewed by Ricky Mondello. Add report.php and populate-from-report.js that process JSON files submitted by builders. * database/populate-from-report.js: Added. (main): (getReport): Obtains the payload (the actual report) from "jobs" table. (recursivelyEnsureTestsIdsAndMetricsIds): "reports.tests" contain a tree of tests, test metrics, and their results. This function recursively traverses tests and metrics and ensure their ids. (ensureTestId): (metricToUnit): Maps a metric name to a unit. This should really be done in the client side since there is no point in storing unit given that every metric maps to exactly one unit (i.e. the mapping is a "function" in mathematical sense). (ensureMetricId): (ensureRepositoryIdsForAllRevisions): (getIdOrCreateBuildWithRevisions): (ensureBuildIdAndRevisions): Obtains a build id given a builder name, a build number, and a build time if one already exists. If not, then inserts a new build and corresponding revisions information (e.g. build 123 may contain WebKit revision r456789). We don't retrieve rows for revisions since we don't use it elsewhere. (insertRun): Insert new rows into "test_runs" and "run_iterations" tables, thereby recording the new test results all in a single transaction. This allows us to keep the database consistent in that either a build has been reported or not at least in "test_runs" and "run_iterations" tables. It'll be ideal if we could do the same for "builds" and "build_revisions" but that's not a hard requirement as far as other parts of the application are concerned. (scheduleQueriesToInsertRun): * database/process-jobs.js: Add a call to populate-from-report.js. * public/api/report.php: Added. Adds a new job named "report" to be processed by populate-from-report.js. * public/include/db.php: Support parameterized query. * public/include/json-header.php: Always include 'status' in the response so that builder submitting a test result could confirm that the submission indeed succeeded. 2012-12-18 Ryosuke Niwa Rename get(Id)OrCreate*(Id) to ensure*Id as suggested by Ricky on one of his code reviews. * database/aggregate.js: * database/database-common.js: (selectColumnCreatingRowIfNeeded): (ensureRepositoryId): (ensureConfigurationIdFromList): * database/perf-webkit-migrator.js: (.migrateStat.): (.migrateStat): (getOrCreateBuildId): 2012-12-17 Ryosuke Niwa Extract commonly-used functions from aggregate.js and perf-webkit-migrator.js. Reviewed by Ricky Mondello. As a preparation to add report.js that processes a JSON file submitted by bots, extract various functions and classes from aggregate.js and perf-webkit-migrator.js to be shared. * database/aggregate.js: Extracted TaskQueue and SerializedTaskQueue into utility.js. (main): (processBuild): (saveAggregatedResults): * database/database-common.js: (getIdOrCreatePlatform): Extracted from webkit-perf-migrator.js. (getIdOrCreateRepository): Ditto. (getConfigurationsForPlatformAndMetrics): Renamed from fetchConfigurations. Extracted from aggregator.js. (getIdFromListOrInsertConfiguration): Renamed from getOrInsertConfiguration. Extracted from aggregator.js. * database/perf-webkit-migrator.js: * database/utility.js: Added. (TaskQueue): Extracted from aggregator.js. Fixed a bug that prevented tasks added after start() is called from being executed. (TaskQueue.startTasksInQueue): Execute remaining tasks without serializing them. If the queue is empty, call the callback passed into start(). (TaskQueue.taskCallback): The function each task calls back. Decrement the counter and call statTasksInQueue. (TaskQueue.addTask): (TaskQueue.start): (SerializedTaskQueue): Unlike TaskQueue, this class executes each task sequentially. (SerializedTaskQueue.executeNextTask): (SerializedTaskQueue.addTask): (SerializedTaskQueue.start): 2012-12-18 Ryosuke Niwa Revert erroneously committed changes. * database/config.json: 2012-12-18 Ryosuke Niwa aggregator.js should be able to accept multiple metric ids and a single build id. Reviewed by Ricky Mondello. Make aggregator.js accept multiple ids and generate results for single build when bots are reporting new results. * database/aggregate.js: (parseArgv): Added. Returns an object containing the parsed representation of argv, which currently contains metricIDs and buildIds. (main): Use parseArgv and processConfigurations (processPlatform): Use build ids passed in or obtain all builds for the given platform. (processPlatform.processConfigurations): Extracted. 2012-12-17 Ryosuke Niwa Add an administrative page for builders. Reviewed by Ricky Mondello. We need an administrative page to add and edit builder information. Also renamed "slaves" to "builders" in order to reduce the amount of technical jargon we use. * database/init-database.sql: Renamed slaves table to builders. Drop slave_os and slave_spec since we don't have plans to use those columns in near future. Also make builder_name unique as required by the rest of the app. * public/admin/builders.php: Added. * public/api/runs.php: Updated per the table rename. * public/include/admin-header.php: Added a link to builders.php. 2012-12-14 Ryosuke Niwa Build fixes for r46982. * database/aggregate.js: (fetchConfigurations): Bind i so that it's not always metricIds.length. (fetchBuildsForPlatform): Return run_build as build_id since that's what caller expects. (processBuild): Don't print "." until we've committed transactions. It's misleading. 2012-12-13 Ryosuke Niwa Unreviewed. Move some php files to public/include as suggested by Mark on a code review. * public/admin/aggregators.php: * public/admin/footer.php: Removed. * public/admin/header.php: Removed. * public/admin/index.php: * public/admin/jobs.php: * public/admin/tests.php: * public/api/json-header.php: Removed. * public/api/runs.php: * public/db.php: Removed. * public/include: Added. * public/include/admin-footer.php: Copied from public/admin/footer.php. * public/include/admin-header.php: Copied from public/admin/header.php. * public/include/db.php: Copied from public/db.php. * public/include/json-header.php: Copied from public/api/json-header.php. 2012-12-13 Ryosuke Niwa SafariPerfMonitor: implement naive value aggregation mechanism Reviewed by Ricky Mondello. Added the initial implementation of value aggregation. Also added abilities to configure the dashboard page in tests.php. * database/aggregate.js: Added. (TaskQueue): Added. Execute all tasks at once and waits for those tasks to complete. (TaskQueue.addTask): (TaskQueue.start): (SerializedTaskQueue): Added. Execute tasks sequentially after one another until all of them are completed. (SerializedTaskQueue.addTask): (SerializedTaskQueue.start): (main): (processPlatform): (fetchConfigurations): (fetchBuildsForPlatform): (processBuild): (testsWithDifferentIterationCounts): (aggregateIterationsForMetric): Retrieve run_iterations and aggregate results in memory. (saveAggregatedResults): Insert into test_runs and test_config in transactions. (getOrInsertConfiguration): (fetchAggregators): * database/database-common.js: (fetchTable): Log an error as an error. (getOrCreateId): Extracted from perf-webkit-migrator. (statistics): Added. * database/perf-webkit-migrator.js: (migrateTestConfig): Converted units to respective metric names. Also removed the code to add jobs to update runs JSON since runs JSONs are generated on demand now. (migrateStat): (getOrCreatePlatformId): (getOrCreateTestId): (getOrCreateConfigurationId): (getOrCreateRevisionId): (getOrCreateRepositoryId): (getOrCreateBuildId): * database/process-jobs.js: (processJob): Handle 'aggregate' type. 2012-12-11 Ryosuke Niwa Fix the dashboard after adding test_metrics. Reviewed by Ricky Mondello. Rename test to metrics in various functions and sort tests on the charts page. Also representing whether a test appears or not by setting a flag on dashboard was bogus because test objects are shared by multiple platforms. Instead, store dashboard platform list as intended by the manifest JSON. * public/index.html: (PerfTestRuns): Renamed test to metric. (fetchTest): Ditto. (showCharts): Ditto; also sort metrics' full names before adding them to the select element. (fullName): Moved so that it appears above where it's called. * public/js/helper-classes.js: 2012-12-10 Ryosuke Niwa Update tests.php to reflect recent changes in the database schema. Reviewed by Conrad Shultz. Made the following changes to tests.php: 1. Disallow adding metrics to tests without subtests. 2. Made dashboard configurable by adding checkboxes for each platform on each metric. 3. Linkified tests with subtests instead of showing all them at once. * public/admin/admin.css: (.action-field, .notice): (label): * public/admin/header.php: Specify paths by absolute paths so that tests.php can use PATH_INFO. (execute_query_and_expect_one_row_to_be_affected): Return a boolean. Used in tests.php while adding test_metrics. (add_job): Extracted. * public/admin/tests.php: See above. (array_item_set_default): Added. (array_item_or_default): Renamed from get_value_with_default. (compute_full_name): Extracted. (sort_tests): Ditto. (map_metrics_to_tests): Ditto. 2012-12-06 Ryosuke Niwa SafariPerfMonitor: Linkify test names Reviewed by Simon Fraser. Linkify the headers using metric.test.url when it's provided. * public/index.html: 2012-12-03 Ryosuke Niwa Use parameterized pg_query_params in query_and_fetch_all Reviewed by Conrad Shultz. Address a review comment by Mark by using pg_query_params instead of pg_query in query_and_fetch_all. * public/api/runs.php: * public/db.php: (ctype_alnum_underscore): Added. 2012-12-04 Ryosuke Niwa Update the migration tool to support test_metrics. Reviewed by Mark Rowe. Updated the migration tool from webkit-perf.appspot.com to support test_metrics. Also import run_iteration rows as runs JSON files now include individual values. * database/database-common.js: (addJob): Extracted. * database/perf-webkit-migrator.js: (migrateTestConfig): Interchange the order in which we fetch runs and add configurations so that we can pass in the metric name and unit to getOrCreateConfigurationId. (getOrCreateConfigurationId): Updated to add both test configuration and test metric. (ensureCheckout): 2012-12-03 Ryosuke Niwa Build fix. Suppress "Undefined index" warning. * public/admin/tests.php: 2012-12-03 Ryosuke Niwa Fix a commit error in r46756. api/ should obviously be added under public/ * api: Removed. * api/json-header.php: Removed. * api/runs.php: Removed. * public/api: Copied from api. 2012-12-03 Ryosuke Niwa SafariPerfMonitor: Linkify revisions and revisions range Reviewed by Mark Rowe. Linkify revisions in TestBuild.label. Pass in manifest.repositories to TestBuild's constructor since it needs to know "url" and "blameUrl". Also tweaked the appearance of graphs on charts page to better align graphs when unit names are long. * public/index.html: * public/js/helper-classes.js: (TestBuild): (TestBuild.revision): Renamed from webkitRevision. Now returns an arbitrary revision number. (TestBuild.label): Add labels for all revisions. (TestBuild): (.ensureContainer): 2012-12-03 Ryosuke Niwa Make the generation of "runs" JSON dynamic and support test_metrics. Reviewed by Mark Rowe. It turned out that we can fetch all runs for a given configuration in roughly 100-200ms. Since there could be hundreds, if not thousands, of tests for each configuration and users aren't necessarily interested in looking at all test results, it's much more efficient to generate runs JSON dynamically (i.e. polling) upon a request instead of generating all of them when bots report new results (i.e. pushing). Rewrote the script to generate runs JSON in php and also supported test_metrics table. * api: Added. * api/json-header.php: Added. Sets Content-Type and cache policies (10 minutes by default). (exit_with_error): Added. (successful_exit): Added. * api/runs.php: Added. Ported database/database-common.js. It's much shorter in php! * database/generate-runs.js: Removed. * database/process-jobs.js: No longer supports "runs". * public/.htaccess: Added. Always add MultiView so that api/runs can receive a path info. * public/db.php: Print "Nothing to see here." when it's accessed directly. (ends_with): Added. * public/index.html: Fetch runs JSONs from /api/runs/ instead of data/. 2012-12-03 Ryosuke Niwa Update tests.php and sample-data.sql per addition of test_metrics. Rubber-stamped by Timothy Hatcher. Remove a useless code from tests.php that used to update the unit and the url of a test since it's no longer used, and add the UI and the ability to add a new aggregator to a test. Also update the sample data to reflect the addition of test_metrics. * database/sample-data.sql: * public/admin/tests.php: 2012-11-30 Ryosuke Niwa Share more code between admin pages. Reviewed by Timothy Hatcher. Added notice and execute_query_and_expect_one_row_to_be_affected helper functions to share more code between admin pages. Also moved the code to connect to the database into header.php to be shared. Admin pages just need to check the nullity of global $db now. * public/admin/aggregators.php: * public/admin/header.php: (notice): Added (execute_query_and_expect_one_row_to_be_affected): Added. * public/admin/index.php: * public/admin/jobs.php: * public/admin/tests.php: 2012-11-29 Ryosuke Niwa SafariPerfMonitor: Add admin page to edit aggregators Reviewed by Mark Rowe. Add aggregators.php. It's very simple. We should probably share more code between various admin pages. * public/admin/aggregators.php: Added. * public/admin/header.php: * public/admin/jobs.php: Removed an erroneous hidden input element. 2012-11-28 Ryosuke Niwa Fix a syntax error in init-database.sql and add the missing drop table at the beginning. * database/init-database.sql: 2012-11-28 Ryosuke Niwa SafariPerfMonitor: Allow multiple metrics per test Rubber-stamped by Mark Rowe. Introduce a new table test_metrics. This table represents metrics each test can have such as time, memory allocation, frame rate as well as aggregation such as arithmetic mean and geometric mean. Updated admin/tests.php and index.html accordingly. Also create few indexes based on postgres' "explain analysis" as suggested by Mark. * database/generate-manifest.js: (buildPlatformMapIfPossible): * database/generate-runs.js: (fetchRuns): * database/init-database.sql: * database/schema.graffle: * public/admin/admin.css: (table): (tbody.odd): * public/admin/tests.php: * public/index.html: 2012-11-27 Ryosuke Niwa SafariPerfMonitor: Improve the webkit-perf migration tool Reviewed by Mark Rowe. Make the migrator tool skip runs when fetching runs failed since webkit-perf.appspot.com is unreliable and we don't want to pause the whole importation process until the user comes back to decide whether to retry or not. Also place form controls next to each test in tests.php so that users don't have to scroll all the way down to make modifications. Finally, add unique constraint to (run_config, run_build) in test_runs table in order to optimize a query of the form: "SELECT run_id FROM test_runs WHERE run_config = $1 AND run_build = $2", * database/init-database.sql: * database/perf-webkit-migrator.js: (migrateTestConfig): * database/schema.graffle: * public/admin/admin.css: (table): * public/admin/tests.php: 2012-11-16 Ryosuke Niwa Create a new performance dashboard Rubber-stamped by Mark Rowe. Add the initial implementation of the perf dashboard. * database: Added. * database/config.json: Added. * database/database-common.js: Added. (connect): (fetchTable): (manifestPath): (pathToRunsJSON): (pathToLocalScript): (config): * database/generate-manifest.js: Added. (ensureProperty): (buildTestMap): (buildPlatformMapIfPossible): (generateFileIfPossible): * database/perf-webkit-migrator.js: Added. * database/process-jobs.js: Added. * database/sample-data.sql: Added. * database/schema.graffle: Added. * public: Added. * public/admin: Added. * public/admin/README: Added. * public/admin/admin.css: Added. * public/admin/footer.php: Added. * public/admin/header.php: Added. * public/admin/index.php: Added. * public/admin/jobs.php: Added. * public/admin/tests.php: Added. * public/common.css: Added. * public/data: Added. * public/db.php: Added. * public/index.html: Added. * public/js: Added. * public/js/helper-classes.js: Added. * public/js/jquery-1.8.2.min.js: Added. * public/js/jquery.flot.min.js: Added. * public/js/jquery.flot.plugins.js: Added. * public/js/shared.js: Added. (fileNameFromPlatformAndTest): * public/js/statistics.js: Added.