{"id":15069521,"url":"https://github.com/openjdk/jmc7","last_synced_at":"2025-10-05T06:31:38.236Z","repository":{"id":53460556,"uuid":"186764856","full_name":"openjdk/jmc7","owner":"openjdk","description":"https://openjdk.org/projects/jmc","archived":true,"fork":false,"pushed_at":"2021-03-30T08:23:57.000Z","size":19250,"stargazers_count":12,"open_issues_count":1,"forks_count":9,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-09-30T13:05:43.152Z","etag":null,"topics":["java","jmc","mission-control","openjdk"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openjdk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license/COPYRIGHT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-15T06:40:43.000Z","updated_at":"2023-11-29T01:44:02.000Z","dependencies_parsed_at":"2022-09-23T05:04:12.951Z","dependency_job_id":null,"html_url":"https://github.com/openjdk/jmc7","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openjdk%2Fjmc7","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openjdk%2Fjmc7/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openjdk%2Fjmc7/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openjdk%2Fjmc7/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openjdk","download_url":"https://codeload.github.com/openjdk/jmc7/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235370461,"owners_count":18979093,"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":["java","jmc","mission-control","openjdk"],"created_at":"2024-09-25T01:42:59.475Z","updated_at":"2025-10-05T06:31:29.843Z","avatar_url":"https://github.com/openjdk.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mission Control\n\nMission Control is an open source production time profiling and diagnostics tool for Java.\n\nBuilds of Mission Control can currently be found in the Oracle JDK on supported platforms and in the Eclipse marketplace. \n\nFor more information on Mission Control, see http://www.oracle.com/missioncontrol.\n\n### Core API Features\n\n* Core APIs for parsing and processing Java flight recordings \n\n* Core API can *read* recordings from JDK 7 and above\n\n* Core API can *run* on JDK 7 and above\n\n* Core API contains a framework for handling units of measurement and physical quantities\n\n* Core API supports headless analysis of Java flight recordings\n\n\n### Application Features\n\n* An application supporting framework for hosting various useful Java tools \n\n* A tool for visualizing the contents of Java flight recordings, and the results of an automated analysis of the contents\n\n* A JMX Console \n\n* A tool for heap waste analysis\n\n\n### Core API Example\n\nExample for producing an HTML report from the command line:\n\n```bash\njava -cp \u003cthe built core jars\u003e org.openjdk.jmc.flightrecorder.rules.report.html.JfrHtmlRulesReport \u003cfile\u003e [\u003coutputfile\u003e]\n```\n\n\nExample for finding the standard deviation for the java monitor events in a recording:\n\n```java\nimport java.io.File;\n \nimport org.openjdk.jmc.common.IDisplayable;\nimport org.openjdk.jmc.common.item.Aggregators;\nimport org.openjdk.jmc.common.item.IItemCollection;\nimport org.openjdk.jmc.common.item.ItemFilters;\nimport org.openjdk.jmc.common.unit.IQuantity;\nimport org.openjdk.jmc.flightrecorder.JfrAttributes;\nimport org.openjdk.jmc.flightrecorder.JfrLoaderToolkit;\nimport org.openjdk.jmc.flightrecorder.jdk.JdkTypeIDs;\n \n/**\n * Finds out the standard deviation for the java monitor enter events.\n */\npublic class LoadRecording {\n    public static void main(String[] args) throws Exception {         \n        IItemCollection events = JfrLoaderToolkit.loadEvents(new File(args[0]));\n        IQuantity aggregate = events.apply(ItemFilters.type(JdkTypeIDs.MONITOR_ENTER))\n                .getAggregate(Aggregators.stddev(JfrAttributes.DURATION));\n         \n        System.out.println(\"The standard deviation for the Java monitor enter events was \"\n                + aggregate.displayUsing(IDisplayable.AUTO));\n    }\n}\n```\n\n\nExample for programmatically running the rules:\n\n```java\nimport java.io.File;\nimport java.util.concurrent.RunnableFuture;\n \nimport org.example.util.DemoToolkit;\nimport org.openjdk.jmc.common.item.IItemCollection;\nimport org.openjdk.jmc.common.util.IPreferenceValueProvider;\nimport org.openjdk.jmc.flightrecorder.JfrLoaderToolkit;\nimport org.openjdk.jmc.flightrecorder.rules.IRule;\nimport org.openjdk.jmc.flightrecorder.rules.Result;\nimport org.openjdk.jmc.flightrecorder.rules.RuleRegistry;\n \npublic class RunRulesOnFileSimple {\n    public static void main(String[] args) throws Exception {\n        File recording = DemoToolkit.verifyRecordingArgument(RunRulesOnFileSimple.class, args);\n        IItemCollection events = JfrLoaderToolkit.loadEvents(recording);\n         \n        for (IRule rule : RuleRegistry.getRules()) {\n            RunnableFuture\u003cResult\u003e future = rule.evaluate(events, IPreferenceValueProvider.DEFAULT_VALUES);\n            future.run();\n            Result result = future.get();\n            if (result.getScore() \u003e 50) {\n                System.out.println(String.format(\"[Score: %3.0f] Rule ID: %s, Rule name: %s, Short description: %s\",\n                        result.getScore(), result.getRule().getId(), result.getRule().getName(),\n                        result.getShortDescription()));\n            }\n        }\n    }\n}\n```\n\n\nExample for programmatically running rules in parallel (requires JDK8):\n\n```java\nimport java.io.File;\nimport java.util.List;\nimport java.util.concurrent.ExecutionException;\nimport java.util.concurrent.Executor;\nimport java.util.concurrent.Executors;\nimport java.util.concurrent.RunnableFuture;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n \nimport org.openjdk.jmc.common.item.IItemCollection;\nimport org.openjdk.jmc.common.util.IPreferenceValueProvider;\nimport org.openjdk.jmc.flightrecorder.JfrLoaderToolkit;\nimport org.openjdk.jmc.flightrecorder.rules.IRule;\nimport org.openjdk.jmc.flightrecorder.rules.Result;\nimport org.openjdk.jmc.flightrecorder.rules.RuleRegistry;\n \n/**\n * Runs the rules on the events in the specified file in parallel, then prints\n * them in order of descending score.\n */\npublic class RunRulesOnFile {\n    private final static Executor EXECUTOR = Executors\n            .newFixedThreadPool(Runtime.getRuntime().availableProcessors() - 1);\n    private static int limit;\n \n    public static void main(String[] args) throws Exception {\n        if (args.length == 0) {\n            System.out.println(\n                    \"Usage: RunRulesOnFile \u003crecording file\u003e [\u003climit\u003e]\\n\\tThe recording file must be a flight recording from JDK 7 or above. The limit, if set, will only report rules triggered with a score higher or equal than the limit.\");\n            System.exit(2);\n        }\n        IItemCollection events = JfrLoaderToolkit.loadEvents(new File(args[0]));\n        if (args.length \u003e 1) {\n            limit = Integer.parseInt(args[1]);\n        }\n        Stream\u003cRunnableFuture\u003cResult\u003e\u003e resultFutures = RuleRegistry.getRules().stream()\n                .map((IRule r) -\u003e evaluate(r, events));\n        List\u003cResult\u003e results = resultFutures.parallel().map((RunnableFuture\u003cResult\u003e runnable) -\u003e get(runnable))\n                .collect(Collectors.toList());\n        results.sort((Result r1, Result r2) -\u003e Double.compare(r2.getScore(), r1.getScore()));\n        results.stream().forEach(RunRulesOnFile::printResult);\n    }\n \n    public static RunnableFuture\u003cResult\u003e evaluate(IRule rule, IItemCollection events) {\n        RunnableFuture\u003cResult\u003e evaluation = rule.evaluate(events, IPreferenceValueProvider.DEFAULT_VALUES);\n        EXECUTOR.execute(evaluation);\n        return evaluation;\n    }\n \n    public static Result get(RunnableFuture\u003cResult\u003e resultFuture) {\n        try {\n            return resultFuture.get();\n        } catch (InterruptedException | ExecutionException e) {\n            e.printStackTrace();\n        }\n        return null;\n    }\n \n    private static void printResult(Result result) {\n        if (result.getScore() \u003e= limit) {\n            System.out.printf(\"(%.0f) [%s]: %s\\nDetails:\\n%s\\n============\u003cEnd of Result\u003e============\\n\",\n                    result.getScore(), result.getRule().getId(), result.getShortDescription(),\n                    result.getLongDescription() == null ? \"\u003cno description\u003e\" : result.getLongDescription());\n        }\n    }\n}\n```\n\n## Building Mission Control from Source\n\nPrerequisites for building Mission Control:\n1. Install JDK 8, and make sure it is the JDK in use (java -version)\n\n2. Install Maven (version 3.3.x. or above)\n\nFirst get third party dependencies into a local p2 repo and make it available on localhost:\n\n```bash\ncd missioncontrolfolder [where you just cloned the sources]\ncd releng/third-party\nmvn p2:site\nmvn jetty:run\n```\n\nThen in another terminal (in the project root):\n\n```bash\ncd core\nmvn clean install\ncd ..\nmvn package\n```\nNote that you may need to define proxy settings if you happen to be behind a firewall. In your ~/.m2/settings.xml file (if you have none, simply create one), add:\n\n```xml\n\u003csettings\u003e\n  \u003cproxies\u003e\n    \u003cproxy\u003e\n      \u003cid\u003ehttp-proxy\u003c/id\u003e\n      \u003cactive\u003etrue\u003c/active\u003e\n      \u003cprotocol\u003ehttp\u003c/protocol\u003e\n      \u003chost\u003emy.proxy.example.org\u003c/host\u003e\n      \u003cport\u003e80\u003c/port\u003e\n      \u003cnonProxyHosts\u003elocalhost|*.example.org\u003c/nonProxyHosts\u003e\n    \u003c/proxy\u003e\n    \u003cproxy\u003e\n      \u003cid\u003ehttps-proxy\u003c/id\u003e\n      \u003cactive\u003etrue\u003c/active\u003e\n      \u003cprotocol\u003ehttps\u003c/protocol\u003e\n      \u003chost\u003emy.proxy.example.org\u003c/host\u003e\n      \u003cport\u003e80\u003c/port\u003e\n      \u003cnonProxyHosts\u003elocalhost|*.example.org\u003c/nonProxyHosts\u003e\n    \u003c/proxy\u003e\n  \u003c/proxies\u003e\n\u003c/settings\u003e\n\n```\n\n## Running Tests\nTo run the unit tests:\n\n```bash\nmvn verify\n```\n\nTo run the UI tests:\n\n```bash\nmvn verify -P uitests\n```\nNote that the UI tests will take some time to run, and that you need to stop interacting with your computer for the duration of the tests.\n\nSpotbugs can take some time to run. If you are only interested in the test results, you can skip running spotbugs by setting `-Dspotbugs.skip=true`.\n\nFor example:\n\n```bash\nmvn verify -P uitests -Dspotbugs.skip=true\n```\n\n## Filtering Test Runs\nAside from the from the simple -test Maven flag test classes that should be run/not run can be specified by means of the system properties \"test.includes\" and/or \"test.excludes\". Multiple patterns can be specified by comma separation.\n\nFor example:\n\n```bash\nmvn verify -Dtest.includes=**/*TestRulesWithJfr*,**/*StacktraceModelTest*\n```\n\nWhen specifying both test.includes and \"test.excludes\" the test.excludes takes precedence and filters out tests that also are matched by \"test.includes\".\n\nFor example:\n\n```bash\nmvn verify -P uitests -Dtest.includes=**/*SystemTabTest*,**/*TestRulesWithJfr*,**/*StacktraceModelTest* -Dtest.excludes=**/*ModelTest*\n```\n\nThe above will not run StacktraceModelTest, as that is also matched by \"test.excludes\".\n\nNote that if UI-tests are supposed to be part of the filtered run the \"uitests\" profile needs to be specified as well. Otherwise the UI won't start up and so the tests fail.\n\n\n## Building using docker and docker-compose\n\n```\ndocker-compose -f docker/docker-compose.yml run jmc\n```\n\nOnce build has finished the results will be in the `target` directory\n\n## Running the Locally Built JMC\nThe built JMC will end up in the `target` folder in the root. The launcher is located in `target/products/org.openjdk.jmc/\u003cplatform\u003e`. By default whichever JRE is on the path \nwill be used. Remember to set it to a JDK (rather than a JRE) if you want the launched mission control to automatically discover locally running JVMs. To override which JVM \nto use when launching, add -vm and the path to a directory where a JDK java launcher is located, for example -vm $JAVA_HOME/bin.\n\nHere is an example for Mac OS X:\n\n```bash\ntarget/products/org.openjdk.jmc/macosx/cocoa/x86_64/JDK\\ Mission\\ Control.app/Contents/MacOS/jmc\n```\n\nHere is an example for Linux:\n\n```bash\ntarget/products/org.openjdk.jmc/linux/gtk/x86_64/jmc\n```\n\nAnd here is an example for Windows x64:\n\n```bash\ntarget\\products\\org.openjdk.jmc\\win32\\win32\\x86_64\\jmc.exe\n```\n\n## Using the Built JMC Update Site in Eclipse\nAs part of the JMC build, the JMC update sites will be built. \n\nThere is one update site for the stand-alone RCP application, providing plug-ins for the stand-alone release of JMC:\n\n```bash\napplication/org.openjdk.jmc.updatesite.rcp/target/\n```\n\nThere is another update site for the Eclipse plug-ins, providing plug-ins for running JMC inside of Eclipse:\n\n```bash\napplication/org.openjdk.jmc.updatesite.ide/target/\n```\n\nTo install it into Eclipe, simply open Eclipse and select Help | Install New Software... In the dialog, click Add... and then click the Archive... button. Select the built update site, e.g. \n\n```bash\napplication/org.openjdk.jmc.updatesite.ide/target/org.openjdk.jmc.updatesite.ide-7.1.1-SNAPSHOT.zip\n```\n\n## Setting Up for Development and Launching in Eclipse\nFirst make sure that you have a recent version of Eclipse. An Eclipse 2018-09 with the JDK 11 plug-in installed (available from Eclipse Marketplace) will do. You may also want to install the Mercurial Plug-in for Eclipse (MercurialEclipse). The Eclipse Marketplace is available under **Help | Eclipse Marketplace...**.\n\nTo set Eclipse up for JMC development, do the following:\n\n1. First ensure that you have started the jetty server in the first step of building JMC.\n2. Next open (File | Open...) the Eclipse target platform of interest, for example releng/platform-definitions/platform-definition-photon/platform.target\n3. In the upper right corner of the platform editor that opens, click the link \"Set as Active Target Platform\"\n4. Import the projects you are interested in (core and/or application) into a recent Eclipse.\n5. If importing the application projects, make sure you create a user library (Preferences | Java/Build Path/User Libraries) named JMC_JDK, and add (Add External JARs...) the following JARs from a JDK 8 (u40 or above) to the User Library:\n - tools.jar (\u003cJDK\u003e/lib/tools.jar)\n - jconsole.jar (\u003cJDK\u003e/lib/jconsole.jar)\n - jfxswt.jar (\u003cJDK\u003e/jre/lib/jfxswt.jar)\n - jfxrt.jar (\u003cJDK\u003e/jre/lib/ext/jfxrt.jar)\n\nNote that importing configuration/ide/eclipse as an Eclipse project should automatically make the development launchers available to you.\n\n## License\nThe Mission Control source code is made available under the Universal Permissive License (UPL), Version 1.0 or a BSD-style license, alternatively. The full open source license text is available at license/LICENSE.txt in the JMC project.\n\n## About\nMission Control is an open source project of the [OpenJDK](http://openjdk.java.net/).\nThe Mission Control project originated from the JRockit JVM project.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenjdk%2Fjmc7","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenjdk%2Fjmc7","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenjdk%2Fjmc7/lists"}