Skip to content

Commit

Permalink
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.
  • Loading branch information
Yorick Peterse committed Nov 8, 2014
1 parent a48dec7 commit 2535035
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions vm/builtin/module.cpp
Expand Up @@ -18,6 +18,9 @@
#include "object_memory.hpp"
#include "on_stack.hpp"

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

#include <string>

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

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

return cNil;
}

Expand Down
3 changes: 3 additions & 0 deletions vm/dtrace/dtrace.h
Expand Up @@ -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
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions vm/dtrace/probes_dummy.h
Expand Up @@ -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)
Expand Down

0 comments on commit 2535035

Please sign in to comment.