-
-
Save gnarg/2974899 to your computer and use it in GitHub Desktop.
Agent Instrumentation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| defined?(ModuleToInstrument) && ModuleToInstrument.respond_to?(:method_to_decorate) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* internal functions */ | |
| wraprec->oldhandler = ((zend_internal_function *) orig_func)->handler; | |
| ((zend_internal_function *) orig_func)->handler = wraprec->wrapper; | |
| wraprec->is_wrapped = 1; | |
| /* user functions */ | |
| nr_per_process_globals.orig_execute = zend_execute; | |
| zend_execute = nr__execute; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| HRESULT Profiler::JITCompilationStarted(FunctionID functionID, BOOL /*fIsSafeToBlock*/) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public byte[] transform(ClassLoader loader, String className, | |
| Class<?> classBeingRedefined, ProtectionDomain protectionDomain, | |
| byte[] classfileBuffer) throws IllegalClassFormatException |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var mthd_without_newrelic_instrumentaiton = shimmer.preserveMethod(Module, 'mthd'); | |
| Module.mthd = mthd_with_newrelic_instrumentation; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mthd_with_newrelic_instrumentation = FunctionTraceWrapper(mthd) | |
| setattr(module, mthd, mthd_with_newrelic_instrumentation) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| alias_method :mthd_without_newrelic_instrumentation, :mthd | |
| alias_method :mthd, :mthd_with_newrelic_instrumentation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # decorative prefix | |
| start = Time.now | |
| begin | |
| # the code under instrumentation | |
| # decorative postfix | |
| ensure | |
| stop = Time.now | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment