void SPPMPassCallback::post_render(
    const Frame&            frame,
    JobQueue&               job_queue,
    AbortSwitch&            abort_switch)
{
    // Shrink the lookup radius for the next pass.
    const float k = (m_pass_number + m_params.m_alpha) / (m_pass_number + 1);
    assert(k <= 1.0);
    m_lookup_radius *= sqrt(k);

    m_stopwatch.measure();

    RENDERER_LOG_INFO(
        "sppm pass %s completed in %s.",
        pretty_uint(m_pass_number + 1).c_str(),
        pretty_time(m_stopwatch.get_seconds()).c_str());

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

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

    try
    {
        OBJMeshFileWriter writer(filename);
        MeshObjectWalker walker(object, object_name);
        writer.write(walker);
    }
    catch (const ExceptionIOError&)
    {
        RENDERER_LOG_ERROR(
            "failed to write mesh file %s: i/o error.",
            filename);
        return false;
    }
    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;
}
Exemple #3
0
bool Frame::write_image(
    const char*             file_path,
    const Image&            image,
    const ImageAttributes&  image_attributes) const
{
    assert(file_path);

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

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

            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, image, image_attributes);
        }
    }
    catch (const ExceptionUnsupportedImageFormat&)
    {
        RENDERER_LOG_ERROR(
            "failed to write image file %s: unsupported image format.",
            file_path);

        return false;
    }
    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;
}
Exemple #4
0
static
void show_vx(xid_t xid)
{
	vx_stat_t statb;
	vx_sched_info_t schedb;
	vx_limit_stat_t limnproc, limvm, limrss;
	vx_uname_t unameb;

	limnproc.id = RLIMIT_NPROC;
	limvm.id = RLIMIT_AS;
	limrss.id = RLIMIT_RSS;
	unameb.id = VHIN_CONTEXT;
	schedb.cpu_id = 0;

	if (vx_stat(xid, &statb) == -1)
		log_perror("vx_stat(%d)", xid);

	else if (vx_limit_stat(xid, &limnproc) == -1)
		log_perror("vx_limit_stat(NPROC, %d)", xid);

	else if (vx_limit_stat(xid, &limvm) == -1)
		log_perror("vx_limit_stat(AS, %d)", xid);

	else if (vx_limit_stat(xid, &limrss) == -1)
		log_perror("vx_limit_stat(RSS, %d)", xid);

	else if (vx_uname_get(xid, &unameb) == -1)
		log_perror("vx_uname_get(CONTEXT, %d)", xid);

	else if (vx_sched_info(xid, &schedb) == -1)
		log_perror("vx_sched_info(%d, 0)", xid);

	else {
		char *p = str_chr(unameb.value, ':', str_len(unameb.value));

		if (p)
			*p = '\0';

		printf("%-5u %-5u %-8s %-8s %-3d %11s %11s %11s %s\n",
				xid, (int) limnproc.value,
				pretty_mem(limvm.value), pretty_mem(limrss.value), 0,
				pretty_time(schedb.user_msec), pretty_time(schedb.sys_msec),
				pretty_time(statb.uptime/1000000), unameb.value);
	}

	if (nr_cpus < 2)
		return;

	int i;

	for (i = 1; i < nr_cpus; i++) {
		schedb.cpu_id = i;

		if (vx_sched_info(xid, &schedb) == -1)
			log_perror("vx_sched_info(%d, %d)", xid, i);

		else printf("%-5u %-5s %-8s %-8s %-3d %11s %11s %11s %s\n",
				xid, "", "", "", i,
				pretty_time(schedb.user_msec), pretty_time(schedb.sys_msec),
				"", unameb.value);
	}
}