Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added dtrace probe for method cache resets.
Browse files Browse the repository at this point in the history
For whatever reason this will either 1) report file names as method names 2)
crash once in a while. Either way, it's a start.
Yorick Peterse committed Nov 8, 2014
1 parent a48dec7 commit 2535035
Showing 4 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions vm/builtin/module.cpp
Original file line number Diff line number Diff line change
@@ -18,6 +18,9 @@
#include "object_memory.hpp"
#include "on_stack.hpp"

#include "call_frame.hpp"
#include "dtrace/dtrace.h"

#include <string>

namespace rubinius {
@@ -195,6 +198,9 @@ namespace rubinius {
}
}
}

RUBINIUS_METHOD_CACHE_RESET_HOOK(state, this, name, state->vm()->saved_call_frame());

return cNil;
}

3 changes: 3 additions & 0 deletions vm/dtrace/dtrace.h
Original file line number Diff line number Diff line change
@@ -36,4 +36,7 @@
#define RUBINIUS_METHOD_PRIMITIVE_RETURN_HOOK(state, module, method, previous) \
RUBINIUS_METHOD_HOOK(PRIMITIVE_RETURN, state, module, method, previous)

#define RUBINIUS_METHOD_CACHE_RESET_HOOK(state, module, method, previous) \
RUBINIUS_METHOD_HOOK(CACHE_RESET, state, module, method, previous)

#endif
8 changes: 8 additions & 0 deletions vm/dtrace/probes.d
Original file line number Diff line number Diff line change
@@ -67,6 +67,14 @@ provider rubinius {
*/
probe method__primitive__return(const char*, const char*, const char*, int);

/*
rubinius::method-cache-reset(classname, methodname, filename, lineno);
This probie is fired whenever a method cache is reset. The arguments are
the same as "rubinius::method-entry".
*/
probe method__cache__reset(const char*, const char*, const char*, int);

/*
rubinius:::gc-begin(full);
3 changes: 3 additions & 0 deletions vm/dtrace/probes_dummy.h
Original file line number Diff line number Diff line change
@@ -34,6 +34,9 @@ extern "C" {
#define RUBINIUS_METHOD_PRIMITIVE_RETURN_ENABLED() 0
#define RUBINIUS_METHOD_PRIMITIVE_RETURN(arg0, arg1, arg2, arg3) do { } while(0)

#define RUBINIUS_METHOD_CACHE_RESET_ENABLED() 0
#define RUBINIUS_METHOD_CACHE_RESET(arg0, arg1, arg2, arg3) do { } while(0)


#define RUBINIUS_GC_BEGIN_ENABLED() 0
#define RUBINIUS_GC_BEGIN(arg0) do { } while(0)

0 comments on commit 2535035

Please sign in to comment.