Mercurial > hg > piper-cpp
changeset 47:fa2edfabf829
Backed out changeset cc333241cc8c
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Mon, 12 Sep 2016 15:17:48 +0100 |
parents | 6fe9f5010505 |
children | ce6cb3308bd7 |
files | json/VampJson.h |
diffstat | 1 files changed, 1 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/json/VampJson.h Mon Sep 12 15:17:35 2016 +0100 +++ b/json/VampJson.h Mon Sep 12 15:17:48 2016 +0100 @@ -49,8 +49,6 @@ #include "bits/PluginHandleMapper.h" #include "bits/RequestResponseType.h" -#include <chrono> - namespace vampipe { /** @@ -319,35 +317,22 @@ static std::string fromFloatBuffer(const float *buffer, size_t nfloats) { - static std::chrono::nanoseconds total; - auto t0 = std::chrono::high_resolution_clock::now(); // must use char pointers, otherwise the converter will only // encode every 4th byte (as it will count up in float* steps) const char *start = reinterpret_cast<const char *>(buffer); const char *end = reinterpret_cast<const char *>(buffer + nfloats); std::string encoded; - encoded.reserve(16 * nfloats / 3); bn::encode_b64(start, end, back_inserter(encoded)); - auto t1 = std::chrono::high_resolution_clock::now(); - total += std::chrono::duration_cast<std::chrono::nanoseconds>(t1 - t0); -// std::cout << "encode: " << total.count()/1000000 << std::endl; return encoded; } static std::vector<float> toFloatBuffer(std::string encoded) { - static std::chrono::nanoseconds total; - auto t0 = std::chrono::high_resolution_clock::now(); std::string decoded; - decoded.reserve(3 * encoded.size() / 4); bn::decode_b64(encoded.begin(), encoded.end(), back_inserter(decoded)); const float *buffer = reinterpret_cast<const float *>(decoded.c_str()); size_t n = decoded.size() / sizeof(float); - std::vector<float> result(buffer, buffer + n); - auto t1 = std::chrono::high_resolution_clock::now(); - total += std::chrono::duration_cast<std::chrono::nanoseconds>(t1 - t0); -// std::cout << "decode: " << total.count()/1000000 << std::endl; - return result; + return std::vector<float>(buffer, buffer + n); } static json11::Json @@ -883,9 +868,6 @@ const PluginHandleMapper &mapper, BufferSerialisation &serialisation) { - static std::chrono::nanoseconds total; - auto t0 = std::chrono::high_resolution_clock::now(); - std::string err; if (!j.has_shape({ @@ -927,10 +909,6 @@ } } - auto t1 = std::chrono::high_resolution_clock::now(); - total += std::chrono::duration_cast<std::chrono::nanoseconds>(t1 - t0); -// std::cout << "parse: " << total.count()/1000000 << std::endl; - return r; }