Commit 215f52d2 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Add some simple exceptions stats

parent 873ac0df
......@@ -28,9 +28,10 @@ namespace pyston {
#define DISABLE_STATS 0
#define STAT_ALLOCATIONS 0 && !DISABLE_STATS
#define STAT_TIMERS 0 && !DISABLE_STATS
#define EXPENSIVE_STAT_TIMERS 0 && STAT_TIMERS
#define STAT_ALLOCATIONS (0 && !DISABLE_STATS)
#define STAT_EXCEPTIONS (0 && !DISABLE_STATS)
#define STAT_TIMERS (0 && !DISABLE_STATS)
#define EXPENSIVE_STAT_TIMERS (0 && STAT_TIMERS)
#if STAT_TIMERS
#define STAT_TIMER(id, name) \
......
......@@ -57,6 +57,15 @@ void raiseRaw(const ExcInfo& e) {
assert(gc::isValidGCObject(e.value));
assert(gc::isValidGCObject(e.traceback));
#if STAT_EXCEPTIONS
std::string stat_name;
if (PyType_Check(e.type))
stat_name = "num_exceptions_" + std::string(static_cast<BoxedClass*>(e.type)->tp_name);
else
stat_name = "num_exceptions_" + std::string(e.value->cls->tp_name);
Stats::log(Stats::getStatCounter(stat_name));
#endif
throw e;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment