- rcf.zip
- RCF
- demo
- vs2003
- RCF
- doc
- include
- RCF
- SF
- license.txt
- src
- RCF
- SF
- test
- vs2003
- RCF
- RCF.sln
- RCF
- RCF.vcproj
- RCFTest
- RCFTest.vcproj
|
#ifndef _TEST_PERFORMANCE_HPP_
#define _TEST_PERFORMANCE_HPP_
#include <string>
#include <boost/lexical_cast.hpp>
#include <RCF/RCF.hpp>
#include <RCF/util/Profile.hpp>
class X
{
public:
void f0() {}
int f1(int) { return 0; }
std::string f2(const std::string &) { return ""; }
};
RCF_BEGIN( I_X, "I_X" )
RCF_METHOD_V0(void, f0)
RCF_METHOD_R1(int, f1, int)
RCF_METHOD_R1(std::string, f2, const std::string &)
RCF_END( I_X )
void runClientTests(const std::string &ip, int port, int calls, int protocol)
{
RcfClient<I_X> client(ip, port);
client.f0();
client.f1(1);
client.f2("");
for (int p=1; p<=10; p++)
{
if (protocol == p || (protocol == 0 && RCF::isProtocolSupported(p)))
{
client.setProtocol(p);
std::string protocolName = RCF::getProtocolName(p);
std::string titleHeader =
"Protocol: " + protocolName +
", Calls: " + boost::lexical_cast<std::string>(calls);
{
std::string title = titleHeader + ", void f()";
util::Profile profile(title);
for (int i=0; i<calls; i++)
{
client.f0();
}
}
{
std::string title = titleHeader + ", int f(int)";
util::Profile profile(title);
for (int i=0; i<calls; i++)
{
client.f1(0);
}
}
{
std::string title = titleHeader + ", std::string f(std::string)";
util::Profile profile(title);
for (int i=0; i<calls; i++)
{
client.f2("");
}
}
}
}
}
#endif // ! _TEST_PERFORMANCE_HPP_
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Software developer, from Sweden and now living in Canberra, Australia, working on distributed C++ applications. When he is not programming, Jarl enjoys skiing and playing table tennis. He derives immense satisfaction from referring to himself in third person.