int main(int argc, char *argv[])
{
    setupLocale();

    std::ios_base::sync_with_stdio(false);

    std::cout.imbue(std::locale());
    std::wcout.imbue(std::locale());

    std::wstring wshort;
    std::string nshort;

    std::wstring wmid;
    std::string nmid;

    std::wstring wlong;
    std::string nlong;

    for (size_t i = 0; i < 3; ++i) {
        wshort += TEXTW;
        nshort += TEXTN;
    }

    for (size_t i = 0; i < 30; ++i) {
        wmid += TEXTW;
        nmid += TEXTN;
    }

    for (size_t i = 0; i < 300; ++i) {
        wlong += TEXTW;
        nlong += TEXTN;
    }

    test(wshort, nshort);
    test(wmid, nmid);
    test(wlong, nlong);

    std::cout << "Test succeeded!" << std::endl;

    std::cout << "Short" << std::endl;
    benchmark(wshort, nshort, WARMUP, BENCH * 10);

    std::cout << "Mid" << std::endl;
    benchmark(wmid, nmid, WARMUP, BENCH);

    std::cout << "Long" << std::endl;
    benchmark(wlong, nlong, WARMUP, BENCH);
}
Exemple #2
0
    Impl(const std::string & name, int argc, char * argv[])
        : pid_(name + ".pid")
    {
        setupLocale();
        mlog::setup((boost::to_upper_copy(name) + "_LOGGING").c_str(), name.c_str());

        std::cout << name << " started" << std::endl;

        iotp_ = boost::in_place();

        if(argc > 1)
            dbopts_ = argv[1];

#if !defined(BOOST_WINDOWS)
        {
            boost::filesystem::ofstream out(pid_);
            out << getpid() << std::endl;
        }
#endif
    }