当前位置: 首页>>代码示例>>C++>>正文


C++ Stopwatch::get_seconds方法代码示例

本文整理汇总了C++中Stopwatch::get_seconds方法的典型用法代码示例。如果您正苦于以下问题:C++ Stopwatch::get_seconds方法的具体用法?C++ Stopwatch::get_seconds怎么用?C++ Stopwatch::get_seconds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stopwatch的用法示例。


在下文中一共展示了Stopwatch::get_seconds方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: write

bool MeshObjectWriter::write(
    const MeshObject&   object,
    const char*         object_name,
    const char*         filename)
{
    assert(filename);

    Stopwatch<DefaultWallclockTimer> stopwatch;
    stopwatch.start();

    try
    {
        GenericMeshFileWriter writer(filename);
        MeshObjectWalker walker(object, object_name);
        writer.write(walker);
    }
    catch (const exception& e)
    {
        RENDERER_LOG_ERROR(
            "failed to write mesh file %s: %s.",
            filename,
            e.what());
        return false;
    }

    stopwatch.measure();

    RENDERER_LOG_INFO(
        "wrote mesh file %s in %s.",
        filename,
        pretty_time(stopwatch.get_seconds()).c_str());

    return true;
}
开发者ID:appleseedhq,项目名称:appleseed,代码行数:34,代码来源:meshobjectwriter.cpp

示例2: write_image

bool Frame::write_image(
    const char*             file_path,
    const Image&            image,
    const ImageAttributes&  image_attributes) const
{
    assert(file_path);

    Image final_image(image);
    transform_to_output_color_space(final_image);

    Stopwatch<DefaultWallclockTimer> stopwatch;
    stopwatch.start();

    try
    {
        try
        {
            GenericImageFileWriter writer;
            writer.write(file_path, final_image, image_attributes);
        }
        catch (const ExceptionUnsupportedFileFormat&)
        {
            const string extension = lower_case(filesystem::path(file_path).extension());

            RENDERER_LOG_ERROR(
                "file format '%s' not supported, writing the image in OpenEXR format "
                "(but keeping the filename unmodified).",
                extension.c_str());

            EXRImageFileWriter writer;
            writer.write(file_path, final_image, image_attributes);
        }
    }
    catch (const ExceptionIOError&)
    {
        RENDERER_LOG_ERROR(
            "failed to write image file %s: i/o error.",
            file_path);

        return false;
    }
    catch (const Exception& e)
    {
        RENDERER_LOG_ERROR(
            "failed to write image file %s: %s.",
            file_path,
            e.what());

        return false;
    }

    stopwatch.measure();

    RENDERER_LOG_INFO(
        "wrote image file %s in %s.",
        file_path,
        pretty_time(stopwatch.get_seconds()).c_str());

    return true;
}
开发者ID:tomcodes,项目名称:appleseed,代码行数:60,代码来源:frame.cpp

示例3: render

    // Render the project.
    MasterRenderer::RenderingResult render()
    {
        // RenderingResult is initialized to Failed.
        RenderingResult result;

        // Perform basic integrity checks on the scene.
        if (!check_scene())
            return result;

        // Initialize thread-local variables.
        Spectrum::set_mode(get_spectrum_mode(m_params));

        // Reset the frame's render info.
        m_project.get_frame()->render_info().clear();

        try
        {
            // Render.
            m_stopwatch.start();
            result.m_status = do_render();
            m_stopwatch.measure();
            result.m_render_time = m_stopwatch.get_seconds();

            // Insert render time into the frame's render info.
            // Note that the frame entity may have replaced during rendering.
            ParamArray& render_info = m_project.get_frame()->render_info();
            render_info.insert("render_time", result.m_render_time);

            // Don't proceed further if rendering failed.
            if (result.m_status != RenderingResult::Succeeded)
                return result;

            // Post-process.
            m_stopwatch.start();
            postprocess(result);
            m_stopwatch.measure();
            result.m_post_processing_time = m_stopwatch.get_seconds();
            render_info.insert("post_processing_time", result.m_post_processing_time);
        }
        catch (const bad_alloc&)
        {
            m_renderer_controller->on_rendering_abort();
            RENDERER_LOG_ERROR("rendering failed (ran out of memory).");
            result.m_status = RenderingResult::Failed;
        }
#ifdef NDEBUG
        catch (const exception& e)
        {
            m_renderer_controller->on_rendering_abort();
            RENDERER_LOG_ERROR("rendering failed (%s).", e.what());
            result.m_status = RenderingResult::Failed;
        }
        catch (...)
        {
            m_renderer_controller->on_rendering_abort();
            RENDERER_LOG_ERROR("rendering failed (unknown exception).");
            result.m_status = RenderingResult::Failed;
        }
#endif

        return result;
    }
开发者ID:luisbarrancos,项目名称:appleseed,代码行数:63,代码来源:masterrenderer.cpp


注:本文中的Stopwatch::get_seconds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。