Commit 2afd421b authored by Kevin Modzelewski's avatar Kevin Modzelewski

more grwl experiments

parent 87202332
......@@ -4,6 +4,7 @@ tools/mcjitcache
tools/mcjitcache_release
tools/publicize
tools/publicize_release
pyston
pyston_opt
pyston_noasserts
......@@ -16,6 +17,8 @@ pyston_prof
pyston_profile
pyston_release
pyston_grwl
pyston_nosync
*.cache
tests/t.py
tests/t2.py
......
......@@ -333,10 +333,10 @@ check:
$(MAKE) lint
$(MAKE) ext pyston_dbg
# $(MAKE) run_unittests
$(MAKE) test_dbg
$(MAKE) test_release
$(MAKE) check_dbg
$(MAKE) check_release
@# jit_prof forces the use of GCC as the compiler, which can expose other errors, so just build it and see what happens:
# $(MAKE) test_prof
# $(MAKE) check_prof
$(MAKE) pyston_prof
$(call checksha,./pyston_prof -cq $(TESTS_DIR)/raytrace_small.py,0544f4621dd45fe94205219488a2576b84dc044d)
$(call checksha,./pyston_prof -cqn $(TESTS_DIR)/raytrace_small.py,0544f4621dd45fe94205219488a2576b84dc044d)
......@@ -585,6 +585,7 @@ PASS_OBJS := $(PASS_SRCS:.cpp=.standalone.o)
$(call make_compile_config,,$(CXXFLAGS_DBG))
$(call make_compile_config,.release,$(CXXFLAGS_RELEASE))
$(call make_compile_config,.grwl,$(CXXFLAGS_RELEASE) -DTHREADING_USE_GRWL=1 -DTHREADING_USE_GIL=0 -UBINARY_SUFFIX -DBINARY_SUFFIX=_grwl)
$(call make_compile_config,.nosync,$(CXXFLAGS_RELEASE) -DTHREADING_USE_GRWL=0 -DTHREADING_USE_GIL=0 -UBINARY_SUFFIX -DBINARY_SUFFIX=_nosync)
$(UNITTEST_SRCS:.cpp=.o): CXXFLAGS += -isystem $(GTEST_DIR)/include
......@@ -657,6 +658,7 @@ $(call link,_dbg,$(OBJS),$(LDFLAGS),$(LLVM_DEPS))
$(call link,_debug,$(OBJS),$(LDFLAGS_DEBUG),$(LLVM_DEBUG_DEPS))
$(call link,_release,$(OPT_OBJS),$(LDFLAGS_RELEASE),$(LLVM_RELEASE_DEPS))
$(call link,_grwl,stdlib.grwl.bc.o $(SRCS:.cpp=.grwl.o),$(LDFLAGS_RELEASE),$(LLVM_RELEASE_DEPS))
$(call link,_nosync,stdlib.nosync.bc.o $(SRCS:.cpp=.nosync.o),$(LDFLAGS_RELEASE),$(LLVM_RELEASE_DEPS))
pyston_oprof: $(OPT_OBJS) codegen/profiling/oprofile.o $(LLVM_DEPS)
$(ECHO) Linking $@
$(VERB) $(CXX) $(OPT_OBJS) codegen/profiling/oprofile.o $(LDFLAGS_RELEASE) -lopagent -o $@
......@@ -695,8 +697,8 @@ RUN_DEPS := ext
define make_target
$(eval \
.PHONY: test$1
test$1: pyston$1 ext
.PHONY: test$1 check$1
check$1 test$1: pyston$1 ext
python ../tools/tester.py -R pyston$1 -j$(TEST_THREADS) -k $(TESTS_DIR) $(ARGS)
python ../tools/tester.py -R pyston$1 -j$(TEST_THREADS) -a -n -k $(TESTS_DIR) $(ARGS)
python ../tools/tester.py -R pyston$1 -j$(TEST_THREADS) -a -O -k $(TESTS_DIR) $(ARGS)
......@@ -757,6 +759,7 @@ perf_%: perf_release_%
$(call make_target,_dbg)
$(call make_target,_release)
$(call make_target,_grwl)
$(call make_target,_nosync)
# "kill valgrind":
kv:
......
......@@ -16,6 +16,8 @@
#include <algorithm>
#include "core/thread_utils.h"
namespace pyston {
std::vector<long>* Stats::counts;
......@@ -23,6 +25,12 @@ std::unordered_map<int, std::string>* Stats::names;
StatCounter::StatCounter(const std::string& name) : id(Stats::getStatId(name)) {
}
StatPerThreadCounter::StatPerThreadCounter(const std::string& name) {
char buf[80];
snprintf(buf, 80, "%s_t%d", name.c_str(), threading::gettid());
id = Stats::getStatId(buf);
}
int Stats::getStatId(const std::string& name) {
// hacky but easy way of getting around static constructor ordering issues for now:
static std::unordered_map<int, std::string> names;
......
......@@ -46,6 +46,17 @@ public:
void log(int count = 1) { Stats::log(id, count); }
};
struct StatPerThreadCounter {
private:
int id = 0;
public:
StatPerThreadCounter(const std::string& name);
void log(int count = 1) { Stats::log(id, count); }
};
}
#endif
......@@ -18,9 +18,13 @@
#include <pthread.h>
#include <unordered_map>
#include "core/common.h"
namespace pyston {
namespace threading {
pid_t gettid();
template <typename T> class _LockedRegion {
private:
T* const mutex;
......
......@@ -427,7 +427,7 @@ void allowGLReadPreemption() {
assert(grwl_state == GRWLHeldState::R);
gl_check_count++;
if (gl_check_count < 1000)
if (gl_check_count < 10)
return;
gl_check_count = 0;
......
......@@ -160,14 +160,15 @@ void runCollection() {
if (VERBOSITY("gc") >= 2)
printf("Collection #%d\n", ++ncollections);
threading::GLPromoteRegion _lock;
//Timer _t2("promoting", /*min_usec=*/10000);
Timer _t("collecting", /*min_usec=*/10000);
threading::GLPromoteRegion _lock;
//long promote_us = _t2.end();
//static thread_local StatPerThreadCounter sc_promoting_us("gc_promoting_us");
//sc_promoting_us.log(promote_us);
// if (ncollections == 754) {
// raise(SIGTRAP);
//}
Timer _t("collecting", /*min_usec=*/10000);
markPhase();
sweepPhase();
......
awk '{if ($0 ~ /%/) { s += $1; print s, "\t", $0 } }'
awk '{if ($0 ~ /%/) { s += $1; n += $2; _s = $1; $1=""; print s, "\t", _s, " \t", n, "\t", $0 } }'
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