serving RESTful: opt for performance

pull/5290/head
xuyongfei 5 years ago
parent a12ad45c2e
commit 7e8ba8cc07

@ -24,6 +24,7 @@
#include <memory>
#include <iostream>
#include <chrono>
#include <vector>
#ifndef ENABLE_ACL
#include "mindspore/core/utils/log_adapter.h"
@ -44,6 +45,19 @@ class LogStream {
return *this;
}
template <typename T>
LogStream &operator<<(const std::vector<T> &val) noexcept {
(*sstream_) << "[";
for (size_t i = 0; i < val.size(); i++) {
(*this) << val[i];
if (i + 1 < val.size()) {
(*sstream_) << ", ";
}
}
(*sstream_) << "]";
return *this;
}
LogStream &operator<<(std::ostream &func(std::ostream &os)) noexcept {
(*sstream_) << func;
return *this;

File diff suppressed because it is too large Load Diff

@ -185,7 +185,7 @@ Status Server::BuildAndStart() {
int32_t http_port = option_args->rest_api_port;
std::string http_addr = "0.0.0.0";
evhttp_set_timeout(http_server, 5);
evhttp_set_timeout(http_server, 60);
evhttp_set_gencb(http_server, http_handler_msg, nullptr);
// grpc server

Loading…
Cancel
Save