Top Description Inners Fields Constructors Methods
org.jruby.runtime.profile.builtin

public Class BuiltinProfilingService

extends Object
implements ProfilingService
Class Inheritance
All Implemented Interfaces
org.jruby.runtime.profile.ProfilingService
Imports
org.jruby.Ruby, .RubyInstanceConfig, org.jruby.internal.runtime.methods.DynamicMethod, .ProfilingDynamicMethod, org.jruby.runtime.ThreadContext, org.jruby.runtime.profile.MethodEnhancer, .ProfileCollection, .ProfileReporter, .ProfilingService

This implementation of org.jruby.runtime.profile.ProfilingService will be used for all profiling methods which are shipped with jruby.
Author
Andre Kullmann

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
private static class

Field Summary

Modifier and TypeField and Description
private final ProfiledMethods

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addProfiledMethod(String
the name
id
,
DynamicMethod
the method
method
)

Implements org.jruby.runtime.profile.ProfilingService.addProfiledMethod.

Add a named method to the profiling service to be monitored.

public BuiltinProfilingService.DefaultMethodEnhancer
public ProfileData
public BuiltinProfilingService.DefaultProfileReporter
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

profiledMethodsback to summary
private final ProfiledMethods profiledMethods

Constructor Detail

BuiltinProfilingServiceback to summary
public BuiltinProfilingService(Ruby runtime)

Method Detail

addProfiledMethodback to summary
public void addProfiledMethod(String id, DynamicMethod method)

Implements org.jruby.runtime.profile.ProfilingService.addProfiledMethod.

Doc from org.jruby.runtime.profile.ProfilingService.addProfiledMethod.

Add a named method to the profiling service to be monitored.

Parameters
id:String

the name

method:DynamicMethod

the method

Annotations
@Override
newMethodEnhancerback to summary
public BuiltinProfilingService.DefaultMethodEnhancer newMethodEnhancer(final Ruby runtime)

Implements org.jruby.runtime.profile.ProfilingService.newMethodEnhancer.

Parameters
runtime:Ruby

Doc from org.jruby.runtime.profile.ProfilingService.newMethodEnhancer.

The ruby instance the returned org.jruby.runtime.profile.MethodEnhancer belongs to

Returns:BuiltinProfilingService.DefaultMethodEnhancer

Doc from org.jruby.runtime.profile.ProfilingService.newMethodEnhancer.

a new org.jruby.runtime.profile.MethodEnhancer instance. will be used to add profiling information to all methods in the given runtime.

Annotations
@Override
newProfileCollectionback to summary
public ProfileData newProfileCollection(ThreadContext context)

Implements org.jruby.runtime.profile.ProfilingService.newProfileCollection.

Parameters
context:ThreadContext

Doc from org.jruby.runtime.profile.ProfilingService.newProfileCollection.

the org.jruby.runtime.ThreadContext the new created org.jruby.runtime.profile.ProfileCollection belongs to.

Returns:ProfileData

Doc from org.jruby.runtime.profile.ProfilingService.newProfileCollection.

a new org.jruby.runtime.profile.ProfileCollection instance, which will be associated with the given context

Annotations
@Override
newProfileReporterback to summary
public BuiltinProfilingService.DefaultProfileReporter newProfileReporter(ThreadContext context)

Implements org.jruby.runtime.profile.ProfilingService.newProfileReporter.

Parameters
context:ThreadContext

Doc from org.jruby.runtime.profile.ProfilingService.newProfileReporter.

the org.jruby.runtime.ThreadContext the returned org.jruby.runtime.profile.ProfileReporter will belongs to.

Returns:BuiltinProfilingService.DefaultProfileReporter

Doc from org.jruby.runtime.profile.ProfilingService.newProfileReporter.

a new instance of org.jruby.runtime.profile.ProfileReporter which can be used to process the collected profile information.

Annotations
@Override
org.jruby.runtime.profile.builtin back to summary

private final Class BuiltinProfilingService.DefaultMethodEnhancer

extends Object
implements MethodEnhancer
Class Inheritance
  • java.lang.Object
  • org.jruby.runtime.profile.builtin.BuiltinProfilingService.DefaultMethodEnhancer
All Implemented Interfaces
org.jruby.runtime.profile.MethodEnhancer

Author
Andre Kullmann

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public DynamicMethod
enhance(String
the name of the given delegate
id
,
DynamicMethod
the method to enhance
delegate
)

Implements org.jruby.runtime.profile.MethodEnhancer.enhance.

Will be called with a method which should be enhanced.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

DefaultMethodEnhancerback to summary
private DefaultMethodEnhancer()

Method Detail

enhanceback to summary
public DynamicMethod enhance(String id, DynamicMethod delegate)

Implements org.jruby.runtime.profile.MethodEnhancer.enhance.

Doc from org.jruby.runtime.profile.MethodEnhancer.enhance.

Will be called with a method which should be enhanced. e.g. with information or callback invocations required by the profiling. In most cases you don't want to profile all methods, just the methods of your own code. So you can add a simple filter here

if( isMyCode( delegate ) ) {
    return new ProfilingDynamicMethod( delegate );
} else {
    return delegate;
}
Parameters
id:String

the name of the given delegate

delegate:DynamicMethod

the method to enhance

Returns:DynamicMethod

the enhanced method. if nothing is to be done, the delegate itself can be returned

Annotations
@Override
@SuppressWarnings:deprecation
org.jruby.runtime.profile.builtin back to summary

private final Class BuiltinProfilingService.DefaultProfileReporter

extends Object
implements ProfileReporter
Class Inheritance
  • java.lang.Object
  • org.jruby.runtime.profile.builtin.BuiltinProfilingService.DefaultProfileReporter
All Implemented Interfaces
org.jruby.runtime.profile.ProfileReporter

Author
Andre Kullmann

Field Summary

Modifier and TypeField and Description
private final ThreadContext

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private RubyInstanceConfig
private Ruby
public void
report(ProfileCollection
the profile information to report. print to file, system out, send ot a profile server, ...
collector
)

Implements org.jruby.runtime.profile.ProfileReporter.report.

At the end of each org.jruby.RubyThread or at jruby shutdown this method is called with the ProfileCollection associated with the current Thread.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextback to summary
private final ThreadContext context

Constructor Detail

DefaultProfileReporterback to summary
public DefaultProfileReporter(ThreadContext context)

Method Detail

getConfigback to summary
private RubyInstanceConfig getConfig()
getRuntimeback to summary
private Ruby getRuntime()
reportback to summary
public void report(ProfileCollection collector)

Implements org.jruby.runtime.profile.ProfileReporter.report.

Doc from org.jruby.runtime.profile.ProfileReporter.report.

At the end of each org.jruby.RubyThread or at jruby shutdown this method is called with the ProfileCollection associated with the current Thread.

Parameters
collector:ProfileCollection

the profile information to report. print to file, system out, send ot a profile server, ...

Annotations
@Override