Sha256: 862119cba4a0f83d91e0241cbbf9283dafe01e9bf5958534d97ab34a303685e9

Contents?: true

Size: 1.82 KB

Versions: 53

Compression:

Stored size: 1.82 KB

Contents

package org.jruby.prof;

import org.jruby.prof.JRubyProf;

import org.jruby.RubyObject;
import org.jruby.RubyModule;
import org.jruby.MetaClass;
import org.jruby.runtime.EventHook;
import org.jruby.runtime.RubyEvent;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;

public class ProfEventHook extends EventHook {
    public void eventHandler(ThreadContext context, String eventName, String file, int line, String methodName, IRubyObject type) {
        RubyModule module = (RubyModule) type;
        String className;
        if (module == null) {
            className = "null";
        }
        else {
            if (module instanceof MetaClass) {
                IRubyObject obj = ((MetaClass) module).getAttached();
                if (obj instanceof RubyModule) {
                    module = (RubyModule) obj;
                    className = "<Class::" + module.getName() + ">";
                }
                else if (obj instanceof RubyObject) {
                    className = "<Instance::" + ((RubyObject) obj).getType().getName() + ">";
                }
                else {
                    className = "unknown";
                }
            }
            else {
                className = module.getName();
            }
        }
        //System.out.printf("eventHandler(_, %s, %s, %d, %s, %s)\n", eventName, file, line, methodName, className);
        if (className.equals("<Class::Java::OrgJrubyProf::JRubyProf>")) return;
        if (eventName.equals("call") || eventName.equals("c-call")) {
            JRubyProf.before(context, className, methodName);
        }
        else if (eventName.equals("return") || eventName.equals("c-return")) {
             JRubyProf.after(context, className, methodName);
       }
    }
    public boolean isInterestedInEvent(RubyEvent event) { return true; }
}

Version data entries

53 entries across 53 versions & 5 rubygems

Version Path
redcar-dev-0.12.16dev-java plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
redcar-dev-0.12.15dev-java plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
redcar-dev-0.12.14dev-java plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
redcar-dev-0.12.13dev-java plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
redcar-dev-0.12.12dev-java plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
redcar-dev-0.12.11dev-java plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
redcar-dev-0.12.10dev-java plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
redcar-dev-0.12.9dev-java plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
redcar-dev-0.12.8dev-java plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
redcar-dev-0.12.7dev-java plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
redcar-dev-0.12.6dev-java plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
redcar-dev-0.12.4dev-java plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
redcar-dev-0.12.3dev-java plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
redcar-dev-0.12.1dev-java plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
redcar-dev-0.12.0dev-java plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
redcar-0.11 plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
redcar-0.11.0dev plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
redcar-0.10 plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
redcar-0.9.2 plugins/redcar_debug/vendor/jruby-prof/src/org/jruby/prof/ProfEventHook.java
rdp-jruby-prof-0.1.0.1 src/org/jruby/prof/ProfEventHook.java