23 #include "util/thrift-util.h"
24 #include "gen-cpp/Types_types.h"
26 #include <boost/shared_ptr.hpp>
27 #include <thrift/protocol/TBinaryProtocol.h>
29 #include <thrift/TApplicationException.h>
30 #include <thrift/transport/TBufferTransports.h>
32 using namespace impala;
35 using namespace apache::thrift::transport;
40 boost::shared_ptr<TTransport> tmem_transport;
41 TBinaryProtocolFactoryT<TMemoryBuffer> tproto_factory;
42 boost::shared_ptr<apache::thrift::protocol::TProtocol> tproto;
49 THostPort deserialized_msg;
52 deserialized_msg.read(data->
tproto.get());
53 }
catch (apache::thrift::protocol::TProtocolException& e) {
54 std::stringstream msg;
55 msg <<
"couldn't deserialize thrift msg:\n" << e.what();
69 int main(
int argc,
char **argv) {
75 hostport.ipaddress =
"0.2.3.4";
76 hostport.hostname =
"localhost";
77 hostport.port = 12345;
78 SerializeThriftMsgToString(&hostport, &s);
79 data.
msg = (uint8_t*)const_cast<char *>(s.c_str());
82 data.
tmem_transport.reset(
new apache::thrift::transport::TMemoryBuffer(
83 const_cast<uint8_t*>(data.
msg), data.
length));
int AddBenchmark(const std::string &name, BenchmarkFunction fn, void *args, int baseline_idx=0)
const StringSearch UrlParser::protocol_search & protocol
std::string Measure()
Runs all the benchmarks and returns the result in a formatted string.
int main(int argc, char **argv)
TBinaryProtocolFactoryT< TMemoryBuffer > tproto_factory
void TestDeserialize(int size, void *d)
boost::shared_ptr< TTransport > tmem_transport
static void Init()
Initialize CpuInfo.
Status DeserializeThriftMsg(JNIEnv *env, jbyteArray serialized_msg, T *deserialized_msg)
boost::shared_ptr< apache::thrift::protocol::TProtocol > tproto
void TestDeserializeSharedState(int size, void *d)