Skip to content

Instantly share code, notes, and snippets.

@klcodanr
Created July 28, 2020 13:36
Show Gist options
  • Save klcodanr/127c39743256d58a663bb46c2e6d5311 to your computer and use it in GitHub Desktop.
Save klcodanr/127c39743256d58a663bb46c2e6d5311 to your computer and use it in GitHub Desktop.
Simple groovy script for use with ICF Groovy Console in AEM to diagnose timing issues in ReferenceProviders
import com.day.cq.wcm.api.reference.ReferenceProvider;
def providers = getServices(ReferenceProvider.class, null);
def resource = resourceResolver.getResource("[PUT_A_PATH_HERE]");
providers.each{provider ->
out.println("");
out.println(provider.class.toString())
long start = System.currentTimeMillis();
def results = provider.findReferences(resource);
out.println("Execution Time: ${System.currentTimeMillis() - start}");
out.println("Results: ${results.size()}");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment