Browse Source

SC: hide timing test code behind macro

tags/v1.3.0
Brian Heim 5 years ago
parent
commit
5f1ec1f124
2 changed files with 8 additions and 3 deletions
  1. +2
    -1
      Makefile
  2. +6
    -2
      src/SuperColliderEngine.cpp

+ 2
- 1
Makefile View File

@@ -78,7 +78,8 @@ endif
ifeq ($(SUPERCOLLIDER), 1)
SOURCES += src/SuperColliderEngine.cpp
FLAGS += -Idep/supercollider/include -Idep/supercollider/include/common -Idep/supercollider/lang -Idep/supercollider/common -Idep/supercollider/include/plugin_interface
FLAGS += -DNDEBUG
FLAGS += -DNDEBUG # TODO is this OK?
# FLAGS += SC_VCV_ENGINE_TIMING # uncomment to turn on timing printing while running
supercollider := dep/supercollider/build/lang/libsclang.a
OBJECTS += $(supercollider)
DEPS += $(supercollider)


+ 6
- 2
src/SuperColliderEngine.cpp View File

@@ -313,18 +313,21 @@ void SC_VcvPrototypeClient::fail(const std::string& msg) noexcept {
_ok = false;
}

// TODO test code
#ifdef SC_VCV_ENGINE_TIMING
static long long int gmax = 0;
static constexpr unsigned int nTimes = 1024;
static long long int times[nTimes] = {};
static unsigned int timesIndex = 0;
#endif

void SC_VcvPrototypeClient::evaluateProcessBlock(ProcessBlock* block) noexcept {
// TODO timing test code
#ifdef SC_VCV_ENGINE_TIMING
auto start = std::chrono::high_resolution_clock::now();
#endif
auto* buf = buildScProcessBlockString(block);
interpret(buf);
readScProcessBlockResult(block);
#ifdef SC_VCV_ENGINE_TIMING
auto end = std::chrono::high_resolution_clock::now();
auto ticks = (end - start).count();

@@ -340,6 +343,7 @@ void SC_VcvPrototypeClient::evaluateProcessBlock(ProcessBlock* block) noexcept {
{
printf("AVG TIME %lld\n", std::accumulate(std::begin(times), std::end(times), 0ull) / nTimes);
}
#endif
}

int SC_VcvPrototypeClient::getResultAsInt(const char* text) noexcept {


Loading…
Cancel
Save