Giter Club home page Giter Club logo

android-lint-performance-probe's Introduction

Android Lint Performance Probe

This is a simple tool to help pinpoint performance bottlenecks in individual Android Lint checks. It uses Java byte code instrumentation to collect and report performance statistics per detector for a Lint analysis invoked from Gradle. It relies on YourKit Probes to do the byte code instrumentation part, although in principle alternative instrumentation agents could be used.

This tool was involved in the 2x-level Lint performance improvements that landed with the Android Studio 3.3 release; there's a blog post with more details.

Getting started

This tool requires a valid YourKit installation. YourKit is a paid profiler, although trial versions are available.

Once YourKit is installed, edit the properties in gradle.properties to point to the corresponding files in your YourKit installation. You will need to set both the yourkitJar property and the yourkitAgent property.

Next, run

$ ./gradlew jvmArgs

to compile the tool and print out the JVM arguments needed to instrument Lint. Here's an example of what those JVM arguments will look like:

-agentpath:/opt/yourkit/bin/linux-x86-64/libyjpagent.so=disableall,probebootclasspath=/path/to/lint-performance-probe/build/libs/lint-performance-probe.jar,probe_on=com.android.tools.probes.LintDetectorStats

Add the generated arguments to your Gradle JVM arguments in an Android project. (See Gradle documentation for how to set the org.gradle.jvmargs property.)

If you are using Android Gradle Plugin 7.0 or higher, you may also need to force Lint to run in-process. You can put the following line in your app's gradle.properties file.

android.experimental.runLintInProcess=true # Needed for AGP 7+

Finally, invoke Lint from Gradle as you normally do. Once Lint finishes, performance statistics for each Lint detector should be printed to the console. Here's some sample output:

$ ./gradlew lintDebug --no-daemon -Dorg.gradle.jvmargs="..."

BUILD SUCCESSFUL in 10s
15 actionable tasks: 1 executed, 14 up-to-date

Lint detector performance stats:
                                     total           self          calls
                 LintDriver        3709 ms        1302 ms           2821
TopDownAnalyzerFacadeForJVM        2121 ms        2121 ms              6
               IconDetector          81 ms          81 ms            257
           OverdrawDetector          51 ms          51 ms             36
     InvalidPackageDetector          34 ms          34 ms          51744
             GradleDetector          20 ms          20 ms             94
       LocaleFolderDetector          11 ms          11 ms            986
         RestrictToDetector          11 ms          11 ms             19
                ApiDetector          11 ms          11 ms           1255
    PrivateResourceDetector          10 ms          10 ms            422
...

Memory allocation instrumentation

The tool also supports measuring memory allocations through the use of an allocation instrumentation agent. To enable this, generate the JVM arguments with this command instead:

$ ./gradlew jvmArgs -Pallocations

Here's some sample output:

BUILD SUCCESSFUL in 22s
15 actionable tasks: 1 executed, 14 up-to-date

Lint detector performance stats:
                                     total           self          calls
                 LintDriver        1473 MB         589 MB           2821
TopDownAnalyzerFacadeForJVM         770 MB         770 MB              6
     AppIndexingApiDetector          67 MB          67 MB              8
                ApiDetector          13 MB          13 MB           1255
               IconDetector          11 MB          11 MB            257
         RestrictToDetector           8 MB           8 MB             19
    PrivateResourceDetector           3 MB           3 MB            422
                RtlDetector           2 MB           2 MB             10
             GradleDetector           2 MB           2 MB             94
           OverdrawDetector           1 MB           1 MB             36

Troubleshooting

  • If you get strange error messages from the Gradle JVM, double check that the JVM arguments are formatted and quoted properly. Quoting may be needed if there are spaces in the file paths, for example. Similarly, be aware that typos in the JVM arguments may cause YourKit to silently ignore the probe.

  • If the JVM arguments have been applied properly but you still don't see performance stats output, it's worth checking to see if YourKit has reported any errors---especially if you've made code changes to the probe. To do this, run java with the JVM arguments generated by this tool. YourKit should print a line to standard error like this.

    [YourKit Java Profiler 2018.04-b88] Log file: /path/to/home/.yjp/log/java-191039.log
    

    Open that log file to see if there were any errors reported. For example, if you added a malformed regular expression to the @MethodPattern annotation in LintDetectorStats.java, you might see a line like this.

    Error: probe class com.android.tools.probes.LintDetectorStats$WrapDetectors: class name pattern is invalid: com.example.lint.checks..*Detector
    

    Conversely, it's a good sign if you see a line like this.

    Registered: com.android.tools.probes.LintDetectorStats
    
  • If you make code changes to the tool, be sure to run ./gradlew assemble in order to rebuild the probe. Also, be sure to start a new Gradle daemon for Lint; otherwise the old version of the tool could still be in use. This is easy to do by using the --no-daemon Gradle flag.

  • The tool may break after changes to Lint class/package names. Please file an issue if the tool stops working for you after an AGP udpate.

Notes and tips

  • The tool will print out three columns for each detector:

    • total shows the total amount of time spent within any method in that detector
    • self is similar to total, but it excludes any time spent in other instrumented callees
    • calls shows the number of calls to any method in that detector
  • In addition to individual Lint detectors, the tool also instruments LintDriver and TopDownAnalyzerFacadeForJVM. LintDriver drives the entire Lint analysis, so it will help show the total time spent in Lint. TopDownAnalyzerFacadeForJVM is essentially the entry point into the Kotlin compiler, so it is a good proxy for how much time is spent upfront analyzing a Kotlin module before Lint detectors can start.

  • To include your own custom Lint checks in the output of the tool, you can add to the list of regular expressions in LintDetectorStats.java.

  • Be aware that caching effects may distort the performance stats for individual detectors. For example, the first Lint check to run might get the blame for the initial cache misses when resolving calls, types, etc.

android-lint-performance-probe's People

Contributors

gharrma avatar neugartf avatar tnorbye avatar vanniktech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-lint-performance-probe's Issues

Running lint results in no performance output

Not sure if I am doing something wrong, but when I try to use this tool I can't seem to get anything to output.

The command I am running is:

./gradlew lintDebug --no-daemon -Dorg.gradle.jvmargs="-agentpath:/Applications/YourKit-Java-Profiler-2019.8.app/Contents/Resources/bin/mac/libyjpagent.dylib=disableall,probebootclasspath=/Users/alockwood/android-lint-performance-probe/build/libs/lint-performance-probe.jar,probe_on=com.android.tools.probes.LintDetectorStats"

And the log is below. Is there anything specific that I might be doing wrong?

19.8-115 0.003: Log file: /Users/alockwood/.yjp/log/GradleDaemon-76754.log
19.8-115 0.003: Command line:
  /Users/alockwood/Library/Java/JavaVirtualMachines/corretto-11.0.8/Contents/Home/bin/java
  -agentpath:/Applications/YourKit-Java-Profiler-2019.8.app/Contents/Resources/bin/mac/libyjpagent.dylib=disableall,probebootclasspath=/Users/alockwood/android-lint-performance-probe/build/libs/lint-performance-probe.jar,probe_on=com.android.tools.probes.LintDetectorStats
  --add-opens
  java.base/java.util=ALL-UNNAMED
  --add-opens
  java.base/java.lang=ALL-UNNAMED
  --add-opens
  java.base/java.lang.invoke=ALL-UNNAMED
  --add-opens
  java.prefs/java.util.prefs=ALL-UNNAMED
  -Dfile.encoding=UTF-8
  -Duser.country=US
  -Duser.language=en
  -Duser.variant
  -cp
  /Users/alockwood/.gradle/wrapper/dists/gradle-6.8.2-bin/5nlkemqlnno2amj7d1mfn69bt/gradle-6.8.2/lib/gradle-launcher-6.8.2.jar
  org.gradle.launcher.daemon.bootstrap.GradleDaemon
  6.8.2
19.8-115 0.003: Executable: /Users/alockwood/Library/Java/JavaVirtualMachines/corretto-11.0.8/Contents/Home/bin/java
19.8-115 0.003: uname:
  sysname: Darwin
  release: 19.6.0
  version: Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64
  machine: x86_64
19.8-115 0.003: macOS; mac; 64-bit process
19.8-115 0.004: hid: 260222X97CT9OPQTS1X2Z50X93 64-bit machine
19.8-115 0.004: Today is 20210420
19.8-115 0.004: full_build_stamp: 2019.8.115 201909231330
19.8-115 0.004: Agent library path: /Applications/YourKit-Java-Profiler-2019.8.app/Contents/Resources/bin/mac/libyjpagent.dylib
19.8-115 0.004: getTimeNsInfo: "1 1"
19.8-115 0.004: Agent_OnLoad: orig_options=disableall,probebootclasspath=/Users/alockwood/android-lint-performance-probe/build/libs/lint-performance-probe.jar,probe_on=com.android.tools.probes.LintDetectorStats
  full_options=disableall,probebootclasspath=/Users/alockwood/android-lint-performance-probe/build/libs/lint-performance-probe.jar,probe_on=com.android.tools.probes.LintDetectorStats
19.8-115 0.004: jvmtiVersion: 300B0000
19.8-115 0.004: phase: 1
19.8-115 0.004: vendor: Amazon.com Inc.
19.8-115 0.004: version: 11.0.8+10-LTS
19.8-115 0.004: specVersion: 11
19.8-115 0.004: info: mixed mode, sharing
19.8-115 0.004: heap_sampling: capability is available
19.8-115 0.004: asynchronous sampling: available
19.8-115 0.004: probeBootClassPath: /Users/alockwood/android-lint-performance-probe/build/libs/lint-performance-probe.jar
19.8-115 0.004: session_id: 329657538782230 (1618945046,76754)
19.8-115 0.005: line_method: 1
19.8-115 0.005: can_generate_exception_events: explicitly disabled with a startup option
19.8-115 0.005: heap_sampling: will be used instead of BCI
19.8-115 0.013: Reusing existing jar file: /tmp/yjp201909231330.jar
19.8-115 0.013: JVMTI 300B0000; 11.0.8+10-LTS; Amazon.com Inc.; mixed mode, sharing; [Java 9 or newer]
19.8-115 0.028: Successfully registered probes: 2
  Registered: .AgentLoadingSupport
  Registered: com.android.tools.probes.LintDetectorStats
19.8-115 0.097: agentStart: 1
19.8-115 0.097: agentStart: 2
19.8-115 0.097: agentStart: OK
19.8-115 0.097: vmInit: 1
19.8-115 0.101: vmInit: 2
19.8-115 0.102: agentInit: 1
19.8-115 0.102: AddModuleExports returned 0:JVMTI_ERROR_NONE
19.8-115 0.102: agentInit: Core loaded
19.8-115 0.102: setTriggers:

19.8-115 0.116: setTriggers: to unregister: 0
19.8-115 0.116: setTriggers: method listeners to register: 0
19.8-115 0.116: setTriggers: OK
19.8-115 0.116: ourUnsafe: true
19.8-115 0.116: shmem 42341490: OK
19.8-115 0.116: shmem 42341493: OK
19.8-115 0.131: socket timeout: 30000
19.8-115 0.132: YourKit Java Profiler agent is listening on port 10003, "listen=localhost"
19.8-115 0.132: *** HINT ***: To get profiling results, connect to the application from the profiler UI
19.8-115 0.135: agentInit: Core.init() called
19.8-115 0.135: Retransform early class: java/io/FileInputStream
19.8-115 0.136: Retransform early class: java/io/FileOutputStream
19.8-115 0.137: agentInit: OK
19.8-115 0.137: vmInit: 3
19.8-115 0.137: onStartProfiling: entering...
19.8-115 0.137: onStartProfiling: done
19.8-115 0.138: vmInit: OK
19.8-115 0.282: GcPauseCounter: installed to G1 Young Generation
19.8-115 0.282: GcPauseCounter: installed to G1 Old Generation
19.8-115 0.287: processorCount=12
19.8-115 9.730: vmDeath: 1
19.8-115 9.730: vmDeath: 2
19.8-115 9.730: vmDeath: 3
19.8-115 9.730: vmDeath: 4
19.8-115 9.730: vmDeath: OK

-agentpath JVM argument is incompatible with projects that use the Gradle Kotlin DSL

Hi! I'm not sure if this is a Gradle bug or an issue with this project, but I thought I'd start here.

My team observed a slowdown in lint when we upgraded to AGP 4.0, and I tried using this tool to profile lint. At first, our build (which uses the Kotlin Gradle DSL) would throw NoSuchMethodErrors during Gradle configuration for methods in the Kotlin stdlib or Kotlin reflect:

$ ./gradlew app:lintInternalDebug --no-daemon --stacktrace -Dorg.gradle.jvmargs="-agentpath:/Applications/YourKit-Java-Profiler-2019.8.app/Contents/Resources/bin/mac/libyjpagent.dylib=disableall,probebootclasspath=/Users/jschear/dev/android-lint-performance-probe/build/libs/lint-performance-probe.jar,probe_on=com.android.tools.probes.LintDetectorStats"

FAILURE: Build failed with an exception.

* What went wrong:
kotlin.jvm.internal.Reflection.typeOf(Ljava/lang/Class;)Lkotlin/reflect/KType;

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
java.lang.NoSuchMethodError: kotlin.jvm.internal.Reflection.typeOf(Ljava/lang/Class;)Lkotlin/reflect/KType;
        at slack.gradle.StandardProjectConfigurations.configureKtlint(StandardProjectConfigurations.kt:1040)
        at slack.gradle.StandardProjectConfigurations.access$configureKtlint(StandardProjectConfigurations.kt:75)
        at slack.gradle.StandardProjectConfigurations$configureKotlinProjects$2.execute(StandardProjectConfigurations.kt:698)
        at slack.gradle.StandardProjectConfigurations$configureKotlinProjects$2.execute(StandardProjectConfigurations.kt:75)
        at org.gradle.api.internal.plugins.DefaultPluginManager$3.execute(DefaultPluginManager.java:252)
        // ...

A teammate pointed out that typeOf was only somewhat recently added to the standard library. It seems like the version of the Kotlin stdlib/reflect present in lint-performance-probe.jar is being used instead of the version we've specified our build. I tried upgrading the version that android-lint-performance-probe uses to match ours (1.3.72), and encountered a different error, when our project's settings.gradle.kts file is being evaluated:

$ ./gradlew app:lintInternalDebug --no-daemon --stacktrace -Dorg.gradle.jvmargs="-agentpath:/Applications/YourKit-Java-Profiler-2019.8.app/Contents/Resources/bin/mac/libyjpagent.dylib=disableall,probebootclasspath=/Users/jschear/dev/android-lint-performance-probe/build/libs/lint-performance-probe.jar,probe_on=com.android.tools.probes.LintDetectorStats"

FAILURE: Build failed with an exception.

* Where:
Settings file '/Users/jschear/dev/slack-android-ng/settings.gradle.kts' line: 5

* What went wrong:
stdlibClassLoader must not be null

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
java.lang.IllegalStateException: stdlibClassLoader must not be null
        at kotlin.reflect.jvm.internal.impl.descriptors.runtime.components.RuntimeModuleData$Companion.create(RuntimeModuleData.kt:87)
        at kotlin.reflect.jvm.internal.ModuleByClassLoaderKt.getOrCreateModule(moduleByClassLoader.kt:58)
        at kotlin.reflect.jvm.internal.KDeclarationContainerImpl$Data$moduleData$2.invoke(KDeclarationContainerImpl.kt:38)
        at kotlin.reflect.jvm.internal.KDeclarationContainerImpl$Data$moduleData$2.invoke(KDeclarationContainerImpl.kt:35)
        // ...
        at kotlin.reflect.jvm.internal.ReflectProperties$LazySoftVal.invoke(ReflectProperties.java:92)
        at kotlin.reflect.jvm.internal.KCallableImpl.getReturnType(KCallableImpl.kt:80)
        at org.gradle.kotlin.dsl.PropertyDelegateKt.propertyDelegateFor(PropertyDelegate.kt:48)
        at org.gradle.kotlin.dsl.SettingsExtensionsKt.provideDelegate(SettingsExtensions.kt:42)
        at Settings_gradle$1.execute(settings.gradle.kts:5)
        at Settings_gradle$1.execute(settings.gradle.kts:1)
        at org.gradle.initialization.DefaultSettings.pluginManagement(DefaultSettings.java:319)
        at Settings_gradle.<init>(Unknown Source)
        at Program.execute(Unknown Source)
        at org.gradle.kotlin.dsl.execution.Interpreter$ProgramHost.eval(Interpreter.kt:502)
        at org.gradle.kotlin.dsl.execution.Interpreter.eval(Interpreter.kt:200)
        at org.gradle.kotlin.dsl.provider.StandardKotlinScriptEvaluator.evaluate(KotlinScriptEvaluator.kt:119)
        // ...

Finally, I took at look at the YourKit documentation and tried changing probebootclasspath to probeclasspath, which let our build progress past the configuration stage, but then lint failed with java.lang.ClassNotFoundException: com.android.tools.probes.LintDetectorStats$WrapDetectors. ๐Ÿ˜…

It appears that putting lint-performance-probe.jar on the classpath breaks the Kotlin Gradle DSL. I reproduced the issue with a small sample project here: https://github.com/jschear/lint-profiler-kotlin-gradle-dsl

Are ALL Detectors expected to be in the output?

When running the probe against my project, I do not see all the Detectors listed in the output. Is EVERY Detector supposed to be in the list, or does it truncate them if they are way at the bottom? I tested this on a small project where lint failed for a custom rule and even on that run the Detector that reported the Issue was not in the list. I may be able to put together a small project that can reproduce this, but won't waste the time unless this is a bug. Thank you!

Question - what would make `LintDriver` take an extremely long time to run?

After updating a project from gradle 5.4.1 to 5.6.4 and com.android.tools.build:gradle from 3.5.2 to 3.6.2, running lint went from a couple minutes to 20+

Lint block looks like this:

{
    abortOnError false
    htmlReport true
    textReport false
    xmlReport true
}

I ran the profiler and this is the output I now have:

Lint detector performance stats:
                                                    total           self          calls
                                LintDriver     1535684 ms     1468709 ms          77536
                            GradleDetector       42737 ms       42737 ms           1664
               TopDownAnalyzerFacadeForJVM       22158 ms       22158 ms              7
                          OverdrawDetector         677 ms         677 ms           1836
                              IconDetector         277 ms         277 ms           6508
                         CallSuperDetector         111 ms         111 ms          15504
                    InvalidPackageDetector         107 ms         107 ms         468259
                           TypedefDetector          86 ms          86 ms           1515
               AppCompatCustomViewDetector          78 ms          78 ms             61
                      ResourceTypeDetector          69 ms          69 ms           8336
                     ByteOrderMarkDetector          65 ms          65 ms           1298
                            ThreadDetector          61 ms          61 ms           1143
                               ApiDetector          54 ms          54 ms          93218
                           CleanupDetector          46 ms          46 ms            457
                   PrivateResourceDetector          37 ms          37 ms          25702
                        PrivateKeyDetector          37 ms          37 ms          11358
                    UnusedResourceDetector          37 ms          36 ms          59746
                      StringFormatDetector          33 ms          33 ms           4912
                       TranslationDetector          30 ms          29 ms          14590
                      MissingClassDetector          29 ms          26 ms          18183
                              TypoDetector          22 ms          22 ms           8844
                     ResourceCycleDetector          13 ms          13 ms          10846
                       MergeMarkerDetector          13 ms          13 ms           5683
                        PrivateApiDetector          12 ms          12 ms             37
                          ViewTypeDetector          12 ms          12 ms           1454

#######################################
##### A lot of really small calls #####
#######################################

                                         -              -              -              -
                                     total     1535745 ms     1535745 ms         983166

Any clue on how to diagnosis the issue ?

EDIT: FYI, report contains 9 errors & 427 warnings
EDIT2: no fancy configuration, ran lint on a single module, for a single build configuration.

No output

I tried using this tool, and everything seems to be working, but no output is printed.

I'm using AGP 4.0.0 Beta 1, and Gradle 6.1.1

Here's the gradle log from when I ran lint:

19.8-137 0.000: Log file: /home/me/.yjp/log/GradleDaemon-23591.log
19.8-137 0.000: Command line:
  /usr/lib/jvm/android-studio-jdk/jre/bin/java
  -agentpath:/home/me/Downloads/yourkit/bin/linux-x86-64/libyjpagent.so=disableall,probebootclasspath=/home/me/workspace/android-lint-performance-probe/build/libs/lint-performance-probe.jar,probe_on=com.android.tools.probes.LintDetectorStats
  -server
  -XX:ReservedCodeCacheSize=240m
  -XX:+UseCompressedOops
  -XX:+UseConcMarkSweepGC
  -XX:MetaspaceSize=512m
  -Xms4g
  -Xmx6g
  -Dfile.encoding=UTF-8
  -Duser.country=US
  -Duser.language=en
  -Duser.variant
  -cp
  /home/me/.sdkman/candidates/gradle/6.1.1/lib/gradle-launcher-6.1.1.jar
  org.gradle.launcher.daemon.bootstrap.GradleDaemon
  6.1.1
19.8-137 0.000: Executable: /usr/lib/jvm/android-studio-jdk/jre/bin/java
19.8-137 0.000: uname:
  sysname: Linux
  release: 5.3.0-40-generic
  version: #32~18.04.1-Ubuntu SMP Mon Feb 3 14:05:59 UTC 2020
  machine: x86_64
19.8-137 0.000: Linux; linux-x86-64; 64-bit process
19.8-137 0.000: hid: 3602215XVWUYXY58ZY72962UXX 64-bit machine
19.8-137 0.000: RAM: 31982 MB
19.8-137 0.000: Today is 20200305
19.8-137 0.000: full_build_stamp: 2019.8.137 202001231851
19.8-137 0.000: Agent library path: /home/me/Downloads/yourkit/bin/linux-x86-64/libyjpagent.so
19.8-137 0.000: getTimeNsInfo: "monotonic_raw"
19.8-137 0.000: Agent_OnLoad: orig_options=disableall,probebootclasspath=/home/me/workspace/android-lint-performance-probe/build/libs/lint-performance-probe.jar,probe_on=com.android.tools.probes.LintDetectorStats
  full_options=disableall,probebootclasspath=/home/me/workspace/android-lint-performance-probe/build/libs/lint-performance-probe.jar,probe_on=com.android.tools.probes.LintDetectorStats
19.8-137 0.000: jvmtiVersion: 30010203
19.8-137 0.000: phase: 1
19.8-137 0.000: vendor: JetBrains s.r.o
19.8-137 0.000: version: 25.202-b49-5587405
19.8-137 0.000: specVersion: 1.8
19.8-137 0.000: info: mixed mode, sharing
19.8-137 0.000: heap_sampling: capability is not available
19.8-137 0.000: asynchronous sampling: available
19.8-137 0.000: probeBootClassPath: /home/me/workspace/android-lint-performance-probe/build/libs/lint-performance-probe.jar
19.8-137 0.000: session_id: 101324156916940 (1583437004,23591)
19.8-137 0.001: line_method: 1
19.8-137 0.001: can_generate_exception_events: explicitly disabled with a startup option
19.8-137 0.009: Reusing existing jar file: /tmp/yjp202001231851.jar
19.8-137 0.009: JVMTI 30010203; 25.202-b49-5587405; JetBrains s.r.o; mixed mode, sharing
19.8-137 0.035: Successfully registered probes: 2
  Registered: .AgentLoadingSupport
  Registered: com.android.tools.probes.LintDetectorStats
19.8-137 0.057: agentStart: 1
19.8-137 0.057: agentStart: 2
19.8-137 0.058: agentStart: OK
19.8-137 0.113: vmInit: 1
19.8-137 0.113: vmInit: 2
19.8-137 0.113: agentInit: 1
19.8-137 0.114: agentInit: Core loaded
19.8-137 0.114: setTriggers:

19.8-137 0.142: setTriggers: to unregister: 0
19.8-137 0.142: setTriggers: method listeners to register: 0
19.8-137 0.142: setTriggers: OK
19.8-137 0.142: ourUnsafe: true
19.8-137 0.142: shmem 42341490: OK
19.8-137 0.150: socket timeout: 30000
19.8-137 0.150: YourKit Java Profiler agent is listening on port 10001, "listen=localhost"
19.8-137 0.150: *** HINT ***: To get profiling results, connect to the application from the profiler UI
19.8-137 0.154: agentInit: Core.init() called
19.8-137 0.154: agentInit: OK
19.8-137 0.154: vmInit: 3
19.8-137 0.154: onStartProfiling: entering...
19.8-137 0.154: onStartProfiling: done
19.8-137 0.154: vmInit: OK
19.8-137 0.242: GcPauseCounter: installed to ParNew
19.8-137 0.242: GcPauseCounter: installed to ConcurrentMarkSweep
19.8-137 0.244: processorCount=12
19.8-137 553.733: warning: long telemetry sample: 126 ms (126/0)
19.8-137 629.335: warning: long telemetry sample: 161 ms (161/0)
19.8-137 1225.240: vmDeath: 1
19.8-137 1225.240: vmDeath: 2
19.8-137 1225.241: vmDeath: 3
19.8-137 1225.241: vmDeath: 4
19.8-137 1225.241: vmDeath: OK

Error occurred during initialization of VM Could not find agent library

gradle.properties set org.gradle.jvmargs:

org.gradle.jvmargs=-agentpath:C:\Program Files\YourKit Java Profiler 2021.3-b223\bin\win64\yjpagent.dll=disableall,probebootclasspath=E:\workspace\android-lint-performance-probe-master\build\libs\lint-performance-probe.jar,probe_on=com.android.tools.probes.LintDetectorStats

Sync project with gradle files fail, error :

Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/6.5/userguide/gradle_daemon.html
Process command line: C:\Program Files\Java\jdk1.8.0_191\bin\java.exe -agentpath:C:/Program Files/YourKit Java Profiler 2021.3-b223/bin/win64/yjpagent.dll=disableall,probebootclasspath=E:/workspace/android-lint-performance-probe-master/build/libs/lint-performance-probe.jar,probe_on=com.android.tools.probes.LintDetectorStats -Dfile.encoding=GBK -Duser.country=CN -Duser.language=zh -Duser.variant -cp C:\Users\Administrator.gradle\wrapper\dists\gradle-6.5-bin\6nifqtx7604sqp1q6g8wikw7p\gradle-6.5\lib\gradle-launcher-6.5.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 6.5
Please read the following process output to find out more:

Error occurred during initialization of VM
Could not find agent library C:/Program in absolute path, with error: Can't find dependent libraries


Check the JVM arguments defined for the gradle process in:

  • gradle.properties in project root directory

No output when LintDetectorStats regex is incorrect

I tried adding to the list of regular expressions in LintDetectorStats to include my custom lint checks when analyzing my project, but I accidentally had a typo in my regular expression.

I had
com.example.lint.checks..*Detector:*(*)
instead of
com.example.lint.checks.*Detector:*(*)

When I ran the tool using the version with the extra ., it ran lint successfully but then gave no output after lint completed. I'd expect to see an error message or some kind of output rather than just nothing.

"Failed to instrument class." when profiling allocations

  • Gradle 6.8.3
  • JDK 11.0.9
  • Android Gradle Plugin 4.2.0-alpha12
  • Kotlin 1.4.32

Upon running ./gradlew jvmArgs -Pallocations I'm told to add jvmargs:

Note: using the allocation instrumentation agent (-Pallocations)

***********************************************************************************
Please use the following JVM arguments to instrument a Lint invocation from Gradle.
Be careful to quote the arguments as needed.

-javaagent:/Users/chr/.gradle/caches/modules-2/files-2.1/com.google.code.java-allocation-instrumenter/java-allocation-instrumenter/3.1.0/d0bdc21c5e6404726b102998e44c66a738897905/java-allocation-instrumenter-3.1.0.jar

-agentpath:/Applications/YourKit-Java-Profiler-2020.9.app/Contents/Resources/bin/mac/libyjpagent.dylib=disableall,probebootclasspath=/Users/chr/Development/android-lint-performance-probe/build/libs/lint-performance-probe.jar,probe_on=com.android.tools.probes.LintDetectorStats

Instrumentation results will be printed to console after the Lint analysis is done.
***********************************************************************************

I can verify that all of these files exist, and when I profile lint's CPU usage normally. (ie: without -Pallocations) it works just fine.

Nevertheless, when using these arguments like so:

gw :app:lintRelease -Dorg.gradle.jvmargs="-javaagent:/Users/chr/.gradle/caches/modules-2/files-2.1/com.google.code.java-allocation-instrumenter/java-allocation-instrumenter/3.1.0/d0bdc21c5e6404726b102998e44c66a738897905/java-allocation-instrumenter-3.1.0.jar -agentpath:/Applications/YourKit-Java-Profiler-2020.9.app/Contents/Resources/bin/mac/libyjpagent.dylib=disableall,probebootclasspath=/Users/chr/Development/android-lint-performance-probe/build/libs/lint-performance-probe.jar,probe_on=com.android.tools.probes.LintDetectorStats"

I encounter a stacktrace like so:

Failed to instrument class.
java.lang.IllegalArgumentException
        at com.google.monitoring.runtime.instrumentation.asm.ClassReader.<init>(ClassReader.java:160)
        at com.google.monitoring.runtime.instrumentation.asm.ClassReader.<init>(ClassReader.java:143)
        at com.google.monitoring.runtime.instrumentation.asm.ClassReader.<init>(ClassReader.java:418)
        at com.google.monitoring.runtime.instrumentation.StaticClassWriter$ClassInfo.<init>(StaticClassWriter.java:166)
        at com.google.monitoring.runtime.instrumentation.StaticClassWriter$ClassInfo.getSuperclass(StaticClassWriter.java:214)
        at com.google.monitoring.runtime.instrumentation.StaticClassWriter$ClassInfo.isSubclassOf(StaticClassWriter.java:252)
        at com.google.monitoring.runtime.instrumentation.StaticClassWriter$ClassInfo.isAssignableFrom(StaticClassWriter.java:265)
        at com.google.monitoring.runtime.instrumentation.StaticClassWriter.getCommonSuperClass(StaticClassWriter.java:101)
        at com.google.monitoring.runtime.instrumentation.asm.ClassWriter.getMergedType(ClassWriter.java:1729)
        at com.google.monitoring.runtime.instrumentation.asm.Frame.merge(Frame.java:1530)
        at com.google.monitoring.runtime.instrumentation.asm.Frame.merge(Frame.java:1429)
        at com.google.monitoring.runtime.instrumentation.asm.MethodWriter.visitMaxs(MethodWriter.java:1497)
        at com.google.monitoring.runtime.instrumentation.asm.MethodVisitor.visitMaxs(MethodVisitor.java:867)
        at com.google.monitoring.runtime.instrumentation.asm.tree.MethodNode.accept(MethodNode.java:835)
        at com.google.monitoring.runtime.instrumentation.asm.commons.JSRInlinerAdapter.visitEnd(JSRInlinerAdapter.java:187)
        at com.google.monitoring.runtime.instrumentation.asm.MethodVisitor.visitEnd(MethodVisitor.java:878)
        at com.google.monitoring.runtime.instrumentation.asm.MethodVisitor.visitEnd(MethodVisitor.java:878)
        at com.google.monitoring.runtime.instrumentation.asm.ClassReader.readMethod(ClassReader.java:1130)
        at com.google.monitoring.runtime.instrumentation.asm.ClassReader.accept(ClassReader.java:698)
        at com.google.monitoring.runtime.instrumentation.asm.ClassReader.accept(ClassReader.java:500)
        at com.google.monitoring.runtime.instrumentation.AllocationInstrumenter.instrument(AllocationInstrumenter.java:188)
        at com.google.monitoring.runtime.instrumentation.AllocationInstrumenter.instrument(AllocationInstrumenter.java:210)
        at com.google.monitoring.runtime.instrumentation.AllocationInstrumenter.transform(AllocationInstrumenter.java:157)
        at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:246)
        at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
        at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:563)
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:550)
        at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
        at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
        at org.gradle.internal.classloader.TransformingClassLoader.findClass(TransformingClassLoader.java:52)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
        at java.base/java.lang.Class.getDeclaredMethods(Class.java:2309)
        at org.gradle.internal.service.RelevantMethodsBuilder.<init>(RelevantMethodsBuilder.java:40)
        at org.gradle.internal.service.RelevantMethods.buildRelevantMethods(RelevantMethods.java:59)
        at org.gradle.internal.service.RelevantMethods.getMethods(RelevantMethods.java:51)
        at org.gradle.internal.service.DefaultServiceRegistry.findProviderMethods(DefaultServiceRegistry.java:162)
        at org.gradle.internal.service.DefaultServiceRegistry.addProvider(DefaultServiceRegistry.java:250)
        at org.gradle.internal.service.DefaultServiceRegistry$1.addProvider(DefaultServiceRegistry.java:231)
        at org.gradle.api.internal.artifacts.DependencyServices.registerBuildServices(DependencyServices.java:43)
        at org.gradle.internal.service.scopes.BuildScopeServices.lambda$new$0(BuildScopeServices.java:208)
        at org.gradle.internal.service.DefaultServiceRegistry.register(DefaultServiceRegistry.java:208)
        at org.gradle.internal.service.scopes.BuildScopeServices.<init>(BuildScopeServices.java:202)
        at org.gradle.initialization.DefaultGradleLauncherFactory.doNewInstance(DefaultGradleLauncherFactory.java:122)
        at org.gradle.initialization.DefaultGradleLauncherFactory.doNewInstance(DefaultGradleLauncherFactory.java:101)
        at org.gradle.initialization.DefaultGradleLauncherFactory.newInstance(DefaultGradleLauncherFactory.java:80)
        at org.gradle.composite.internal.DefaultRootBuildState.<init>(DefaultRootBuildState.java:47)
        at org.gradle.composite.internal.DefaultIncludedBuildRegistry.createRootBuild(DefaultIncludedBuildRegistry.java:90)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:52)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:29)
        at org.gradle.launcher.exec.BuildTreeScopeLifecycleBuildActionExecuter.lambda$execute$0(BuildTreeScopeLifecycleBuildActionExecuter.java:33)
        at org.gradle.internal.buildtree.BuildTreeState.run(BuildTreeState.java:49)
        at org.gradle.launcher.exec.BuildTreeScopeLifecycleBuildActionExecuter.execute(BuildTreeScopeLifecycleBuildActionExecuter.java:32)
        at org.gradle.launcher.exec.BuildTreeScopeLifecycleBuildActionExecuter.execute(BuildTreeScopeLifecycleBuildActionExecuter.java:27)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:104)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:55)
        at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:64)
        at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:37)
        at org.gradle.tooling.internal.provider.SessionScopeLifecycleBuildActionExecuter.lambda$execute$0(SessionScopeLifecycleBuildActionExecuter.java:54)
        at org.gradle.internal.session.BuildSessionState.run(BuildSessionState.java:67)
        at org.gradle.tooling.internal.provider.SessionScopeLifecycleBuildActionExecuter.execute(SessionScopeLifecycleBuildActionExecuter.java:50)
        at org.gradle.tooling.internal.provider.SessionScopeLifecycleBuildActionExecuter.execute(SessionScopeLifecycleBuildActionExecuter.java:36)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:59)
        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:31)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55)
        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:41)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:47)
        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:31)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:65)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:39)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:29)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:35)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:78)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:75)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:75)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:63)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:84)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
        at java.base/java.lang.Thread.run(Thread.java:834)

Security Policy violation Binary Artifacts

This issue was automatically created by Allstar.

Security Policy Violation
Project is out of compliance with Binary Artifacts policy: binaries present in source code

Rule Description
Binary Artifacts are an increased security risk in your repository. Binary artifacts cannot be reviewed, allowing the introduction of possibly obsolete or maliciously subverted executables. For more information see the Security Scorecards Documentation for Binary Artifacts.

Remediation Steps
To remediate, remove the generated executable artifacts from the repository.

Artifacts Found

  • gradle/wrapper/gradle-wrapper.jar

Additional Information
This policy is drawn from Security Scorecards, which is a tool that scores a project's adherence to security best practices. You may wish to run a Scorecards scan directly on this repository for more details.


Allstar has been installed on all Google managed GitHub orgs. Policies are gradually being rolled out and enforced by the GOSST and OSPO teams. Learn more at http://go/allstar

This issue will auto resolve when the policy is in compliance.

Issue created by Allstar. See https://github.com/ossf/allstar/ for more information. For questions specific to the repository, please contact the owner or maintainer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.