Ejemplo n.º 1
0
void childTask(long iterations, int entropy_i, char* src, char* dest, size_t b_size, size_t t_size){
    int i = 0;
    srand(entropy_mat[entropy_i]);
    for(i=0; i < 100; i++){
        calcPi(iterations/100);
        runDisk(b_size, t_size/100, src, dest);
    }
}
Ejemplo n.º 2
0
int main(int argc, char* argv[])
{
    try {
        /* looking for the init file in $srcdir is a requirement of
           automake's distcheck target.
        */
        char* srcdir = std::getenv("srcdir");
        std::string initFileName;
        if (srcdir == NULL) {
            initFileName = "./log4cpp.init";
        }
        else {
            initFileName = std::string(srcdir) + "/log4cpp.init";
        }
        log4cpp::SimpleConfigurator::configure(initFileName);
    } catch(log4cpp::ConfigureFailure& f) {
        std::cout << "Configure Problem " << f.what() << std::endl;
        return -1;
    }

    log4cpp::Category& root = log4cpp::Category::getRoot();

    log4cpp::Category& sub1 = 
        log4cpp::Category::getInstance(std::string("sub1"));

    log4cpp::Category& sub2 = 
        log4cpp::Category::getInstance(std::string("sub1.sub2"));

    root.error("root error");
    root.warn("root warn");
    sub1.error("sub1 error");
    sub1.warn("sub1 warn");

    calcPi();

    sub2.error("sub2 error");
    sub2.warn("sub2 warn");

    root.error("root error");
    root.warn("root warn");
    sub1.error("sub1 error");
    sub1.warn("sub1 warn");

#ifdef WIN32
    Sleep(3000);
#else
    sleep(3);
#endif

    sub2.error("sub2 error");
    sub2.warn("sub2 warn");
    sub2.error("%s %s %d", "test", "vform", 123);
    sub2.warnStream() << "streamed warn";

    sub2 << log4cpp::Priority::WARN << "warn2.." << "..warn3..value=" << 0 
         << log4cpp::eol << "..warn4";

    log4cpp::Category::shutdown();

    return 0;
}