{"id":22689970,"url":"https://github.com/yahoojapan/xcmetricsaggregator","last_synced_at":"2025-04-12T22:07:46.552Z","repository":{"id":56898667,"uuid":"233773883","full_name":"yahoojapan/XCMetricsAggregator","owner":"yahoojapan","description":"Automation tool for Xcode Metrics Organizer with AppleScript","archived":false,"fork":false,"pushed_at":"2020-03-14T02:38:16.000Z","size":164,"stargazers_count":63,"open_issues_count":0,"forks_count":5,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-12T22:07:37.054Z","etag":null,"topics":["app","applescript","gem","ios","launchd","macos","organizer","ruby","xcode"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yahoojapan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-14T06:38:39.000Z","updated_at":"2025-03-28T08:39:34.000Z","dependencies_parsed_at":"2022-08-20T17:40:44.796Z","dependency_job_id":null,"html_url":"https://github.com/yahoojapan/XCMetricsAggregator","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoojapan%2FXCMetricsAggregator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoojapan%2FXCMetricsAggregator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoojapan%2FXCMetricsAggregator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoojapan%2FXCMetricsAggregator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yahoojapan","download_url":"https://codeload.github.com/yahoojapan/XCMetricsAggregator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248637769,"owners_count":21137538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["app","applescript","gem","ios","launchd","macos","organizer","ruby","xcode"],"created_at":"2024-12-10T00:24:36.674Z","updated_at":"2025-04-12T22:07:46.532Z","avatar_url":"https://github.com/yahoojapan.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](./assets/XCMetricsAggregator.png)\n\n## What's this?\n\nXCMetricsAggregator aggregates metrics data from [Xcode Metrics Organizer](https://help.apple.com/xcode/mac/current/#/devb642b28ac) with AppleScript. \n\nIt also processes the raw data on your mac device to organize them as table or chart.\n\nYou can check how to use Xcode Metrics Organizer in WWDC 2019 session below.\n\n- [Improving Battery Life and Performance - WWDC 2019](https://developer.apple.com/videos/play/wwdc2019/417/)\n\n## Setup\n\n1. Install Xcode 11.x from App Store or the following link\n\nhttps://developer.apple.com/download/more/\n\n2. Login with your Apple ID on Accounts preferences in Xcode\n\n\u003cimg width=\"400\" alt=\"スクリーンショット 0002-02-09 18 32 32\" src=\"https://user-images.githubusercontent.com/18320004/74100072-1b04b300-4b6e-11ea-97e0-32239898846d.png\"\u003e\n\n3. check Accessibility setting in Security \u0026 Privacy. Script Editor, System Events and Terminal needs to be checked.\n\n\u003cimg width=\"400\" alt=\"Screen Shot 0002-02-10 at 0 34 47\" src=\"https://user-images.githubusercontent.com/18320004/74105018-8c0f8f00-4b9d-11ea-9008-c1f166876b4a.png\"\u003e\n\n\n\n4. Install XCMetricsAggregator\n\n```\ngem install xc_metrics_aggregator\n```\n\n\n## Getting Started\nThere are 2 kinds of command.\n\n- manupulating Xcode automatically\n- processing raw json files for metrics data\n\n\"crowl\" command download the json files with Xcode, and the others process them.\n\nFirst of all, You need to download Xcode Metrics Organizer's raw data on your mac with \"crowl\" command.\n\n### Available feature List\n```\nxcmagg help\n```\n\n### Downloading metrics data \n```\nxcmagg crowl\n```\n\nThis command launches Xcode automatically, and operates the mouse. \n\nIf you interrupt the crowling, input Ctrl + C on the terminal.\n\n\n### Application lookup in metrics data\n```\nxcmagg apps\n```\n\n```\n+--------------------------------------------+---------------------+\n|                        available app list                        |\n+--------------------------------------------+---------------------+\n| bundle id                                  | status              |\n+--------------------------------------------+---------------------+\n| yourapp1                                   | has metrics         |\n| yourapp2                                   | has metrics         |\n+--------------------------------------------+---------------------+\n```\n\n### Available devices for your apps\n```\nxcmagg devices --b yourapp1,yourapp2\n```\n\n```\n+--------------+---------------------------------------+------------+\n|                           yourapp1                                |\n+--------------+---------------------------------------+------------+\n| kind         | device                                | id         |\n+--------------+---------------------------------------+------------+\n| iPhone (All) | iPhone 8                              | iPhone10,1 |\n|              | iPhone X                              | iPhone10,3 |\n|              | iPhone Xs                             | iPhone11,2 |\n|              | iPhone Xs Max                         | iPhone11,6 |\n|              | iPhone Xʀ                             | iPhone11,8 |\n|              | iPhone 11                             | iPhone12,1 |\n+--------------+---------------------------------------+------------+\n| iPad (All)   | iPad (6th Generation)                 | iPad7,5    |\n|              | iPad (7th generation)                 | iPad7,11   |\n|              | iPad Pro (11-inch)                    | iPad8,1    |\n|              | iPad Pro (12.9-inch) (3rd Generation) | iPad8,5    |\n|              | iPad mini (5th generation)            | iPad11,1   |\n|              | iPad Air (3rd generation)             | iPad11,3   |\n+--------------+---------------------------------------+------------+\n\n+--------------+---------------------------------------+------------+\n|                           yourapp2                                |\n+--------------+---------------------------------------+------------+\n| kind         | device                                | id         |\n+--------------+---------------------------------------+------------+\n| iPhone (All) | iPhone 8                              | iPhone10,1 |\n|              | iPhone X                              | iPhone10,3 |\n|              | iPhone Xs                             | iPhone11,2 |\n|              | iPhone Xs Max                         | iPhone11,6 |\n|              | iPhone Xʀ                             | iPhone11,8 |\n|              | iPhone 11                             | iPhone12,1 |\n+--------------+---------------------------------------+------------+\n| iPad (All)   | iPad (6th Generation)                 | iPad7,5    |\n|              | iPad (7th generation)                 | iPad7,11   |\n|              | iPad Pro (11-inch)                    | iPad8,1    |\n|              | iPad Pro (12.9-inch) (3rd Generation) | iPad8,5    |\n|              | iPad mini (5th generation)            | iPad11,1   |\n|              | iPad Air (3rd generation)             | iPad11,3   |\n+--------------+---------------------------------------+------------+\n```\n\n### Available percentiles for your apps\n```\nxcmagg percentiles --b yourapp1,yourapp2\n```\n\n```\n+----------------+--------------------------------------------+\n|                        yourapp1                             |\n+----------------+--------------------------------------------+\n| percentile     | id                                         |\n+----------------+--------------------------------------------+\n| Typical        | com.apple.dt.metrics.percentile.fifty      |\n| Top Percentile | com.apple.dt.metrics.percentile.ninetyFive |\n+----------------+--------------------------------------------+\n\n+----------------+--------------------------------------------+\n|                        yourapp2                             |\n+----------------+--------------------------------------------+\n| percentile     | id                                         |\n+----------------+--------------------------------------------+\n| Typical        | com.apple.dt.metrics.percentile.fifty      |\n| Top Percentile | com.apple.dt.metrics.percentile.ninetyFive |\n+----------------+--------------------------------------------+\n```\n\n### Checking available metricses\n\n```\nxcmagg sections -b yourapp1\n```\n\n```\n+--------------+---------------+--------------+\n|                  yourapp1                   |\n+--------------+---------------+--------------+\n| category     | section       | unit         |\n+--------------+---------------+--------------+\n| performance  | hangRate      | seconds/hour |\n|              | launchTime    | ms           |\n|              | peakMemory    | MB           |\n|              | averageMemory | MB           |\n| diskUsage    | diskWrites    | MB           |\n| batteryUsage | allActivity   | seconds      |\n|              | batteryUsage  | %/day        |\n|              | onScreen      | %            |\n|              | background    | %            |\n+--------------+---------------+--------------+\n```\n\n### Launch time metrics for an app\n```\nxcmagg metrics -s launchTime -b yourapp1 -d iPhone11,6\n```\n\n```\n+-------+-------------+----------+----------------+\n| Label | Version     | Device   | Percentile     |\n+-------+-------------+----------+----------------+\n| 0     | 1.0.0       | iPhone 8 | Typical        |\n| 1     | 1.1.0       | iPhone 8 | Typical        |\n| 2     | 1.3.0       | iPhone 8 | Typical        |\n| 3     | 1.4.0       | iPhone 8 | Typical        |\n| 4     | 1.5.0       | iPhone 8 | Typical        |\n| 5     | 2.0.0       | iPhone 8 | Typical        |\n+-------+-------------+----------+----------------+\n\n700.0|                  \n600.0|                  \n500.0|          *       \n400.0|          *       \n300.0|    *  *  *  *  *  \n200.0| *  *  *  *  *  *  \n100.0| *  *  *  *  *  *  \n  0.0+-------------------\n       0  1  2  3  4  5  \n \nUnit: ms\n\n```\n\n\n### Comparison of LaunchTime between your apps\n```\nxcmagg latest -s launchTime -d iPhone11,6 -p com.apple.dt.metrics.percentile.ninetyFive\n```\n\n```\n+-------+-----------------------------------+-------------+\n| Label | Bundle ID                         | Version     |\n+-------+-----------------------------------+-------------+\n| 0     | yourapp1                          | 2.0.0       |\n| 1     | yourapp2                          | 1.1.0       |\n+-------+-----------------------------------+-------------+\n\n700.0|    *              \n600.0|    *              \n500.0|    *     \n400.0|    *  \n300.0| *  * \n200.0| *  * \n100.0| *  * \n  0.0+------\n       0  1 \n \nUnit: ms\n\n```\n\n### Outputting the latest LaunchTime as CSV format\n```\nxcmagg latest -s launchTime -d iPhone11,6 -p com.apple.dt.metrics.percentile.ninetyFive -f csv\n```\n\n```\nLabel,Bundle ID,Version,Point\n0,yourapp1,2.0.0,698\n1,yourapp2,1.1.0,300\n```\n\nYou can send it to your log server\n\n## Run with Launchd to see changes over time\n\nIf you would like to run script periodically, you can use launchd.\n\nCreate plist file to `~/Library/LaunchAgents/xcode-metrics.plist`. \n\n```\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003c!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"\u003e\n\u003cplist version=\"1.0\"\u003e\n\u003cdict\u003e\n    \u003ckey\u003eLabel\u003c/key\u003e\n    \u003cstring\u003excode-metrics\u003c/string\u003e\n    \u003ckey\u003eProgramArguments\u003c/key\u003e\n    \u003carray\u003e\n        \u003cstring\u003e/bin/sh\u003c/string\u003e\n        \u003cstring\u003e/your/path/xcode-metrics-automation/run.sh\u003c/string\u003e\n    \u003c/array\u003e\n    \u003ckey\u003eStartCalendarInterval\u003c/key\u003e\n    \u003cdict\u003e\n      \u003ckey\u003eHour\u003c/key\u003e\n      \u003cinteger\u003e12\u003c/integer\u003e\n      \u003ckey\u003eMinute\u003c/key\u003e\n      \u003cinteger\u003e10\u003c/integer\u003e\n    \u003c/dict\u003e\n    \u003ckey\u003eStandardOutPath\u003c/key\u003e\n    \u003cstring\u003e/tmp/xcode-metrics.out\u003c/string\u003e\n    \u003ckey\u003eStandardErrorPath\u003c/key\u003e\n    \u003cstring\u003e/tmp/xcode-metrics.err\u003c/string\u003e\n\u003c/dict\u003e\n\u003c/plist\u003e\n```\n\nRun this command in Terminal to enable the setting.\n\n```\nlaunchctl load ~/Library/LaunchAgents/xcode-metrics.plist\n```\n\n## License\n\nThis software is released under the MIT License, see LICENSE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyahoojapan%2Fxcmetricsaggregator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyahoojapan%2Fxcmetricsaggregator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyahoojapan%2Fxcmetricsaggregator/lists"}