void SPPMPassCallback::pre_render(
    const Frame&            frame,
    JobQueue&               job_queue,
    IAbortSwitch&           abort_switch)
{
    if (m_initial_lookup_radius > 0.0f)
    {
        RENDERER_LOG_INFO(
            "sppm lookup radius is %f (%s of initial radius).",
            m_lookup_radius,
            pretty_percent(m_lookup_radius, m_initial_lookup_radius, 3).c_str());
    }

    m_stopwatch.start();

    // Create a new set of photons.
    m_photons.clear_keep_memory();
    m_photon_tracer.trace_photons(
        m_photons,
        hash_uint32(m_pass_number),
        job_queue,
        abort_switch);

    // Stop there if rendering was aborted.
    if (abort_switch.is_aborted())
        return;

    // Build a new photon map.
    m_photon_map.reset(new SPPMPhotonMap(m_photons));
}
Example #2
0
string pretty_asset_list( const vector<asset_record>& asset_records, cptr client )
{
    if( asset_records.empty() ) return "No assets found.\n";
    FC_ASSERT( client != nullptr );

    std::stringstream out;
    out << std::left;

    out << std::setw(  6 ) << "ID";
    out << std::setw(  7 ) << "SYMBOL";
    out << std::setw( 24 ) << "NAME";
    out << std::setw( 48 ) << "DESCRIPTION";
    out << std::setw( 32 ) << "ISSUER";
    out << std::setw( 10 ) << "ISSUED";
    out << std::setw( 28 ) << "SUPPLY";
    out << "\n";

    out << pretty_line( 155 );
    out << "\n";

    for( const auto& asset_record : asset_records )
    {
        const auto asset_id = asset_record.id;
        out << std::setw(  6 ) << asset_id;

        out << std::setw(  7 ) << asset_record.symbol;
        out << std::setw( 24 ) << pretty_shorten( asset_record.name, 23 );
        out << std::setw( 48 ) << pretty_shorten( asset_record.description, 47 );

        const auto issuer_id = asset_record.issuer_account_id;
        const auto supply = asset( asset_record.current_share_supply, asset_id );
        if( issuer_id == 0 )
        {
            out << std::setw( 32 ) << "GENESIS";
            out << std::setw( 10 ) << "N/A";
        }
        else if( issuer_id == asset_record::market_issued_asset )
        {
            out << std::setw( 32 ) << "MARKET";
            out << std::setw( 10 ) << "N/A";
        }
        else
        {
            const auto account_record = client->get_chain()->get_account_record( issuer_id );
            FC_ASSERT( account_record.valid() );
            out << std::setw( 32 ) << pretty_shorten( account_record->name, 31 );

            const auto max_supply = asset( asset_record.maximum_share_supply, asset_id );
            out << std::setw( 10 ) << pretty_percent( supply.amount, max_supply.amount);
        }

        out << std::setw( 28 ) << client->get_chain()->to_pretty_asset( supply );

        out << "\n";
    }

    return out.str();
}
Example #3
0
    string CacheStatisticsEntry::to_string() const
    {
        const uint64 accesses = m_hit_count + m_miss_count;

        if (accesses == 0)
            return "n/a";

        return
                "efficiency " + pretty_percent(m_hit_count, accesses)
            + "  accesses " + pretty_uint(accesses)
            + "  hits " + pretty_uint(m_hit_count)
            + "  misses " + pretty_uint(m_miss_count);
    }
void ProgressTileCallback::do_post_render_tile(
    const Frame*    frame,
    const size_t    tile_x,
    const size_t    tile_y)
{
    // Keep track of the total number of rendered pixels.
    const Tile& tile = frame->image().tile(tile_x, tile_y);
    m_rendered_pixels += tile.get_pixel_count();

    // Retrieve the total number of pixels in the frame.
    const size_t total_pixels = frame->image().properties().m_pixel_count;

    // Print a progress message.
    LOG_INFO(m_logger, "rendering, %s done", pretty_percent(m_rendered_pixels, total_pixels).c_str());
}
Example #5
0
string pretty_delegate_list( const vector<account_record>& delegate_records, cptr client )
{
    if( delegate_records.empty() ) return "No delegates found.\n";
    FC_ASSERT( client != nullptr );

    std::stringstream out;
    out << std::left;

    out << std::setw(  6 ) << "ID";
    out << std::setw( 32 ) << "NAME (* next in line)";
    out << std::setw( 15 ) << "APPROVAL";
    out << std::setw(  9 ) << "PRODUCED";
    out << std::setw(  9 ) << "MISSED";
    out << std::setw( 14 ) << "RELIABILITY";
    out << std::setw(  9 ) << "PAY RATE";
    out << std::setw( 20 ) << "PAY BALANCE";
    out << std::setw( 10 ) << "LAST BLOCK";
    out << "\n";

    out << pretty_line( 124 );
    out << "\n";

    const auto current_slot_timestamp = blockchain::get_slot_start_time( blockchain::now() );
    const auto head_block_timestamp = client->get_chain()->get_head_block().timestamp;
    const auto next_slot_time = std::max( current_slot_timestamp, head_block_timestamp + BTS_BLOCKCHAIN_BLOCK_INTERVAL_SEC );
    const auto& active_delegates = client->get_chain()->get_active_delegates();
    const auto next_slot_signee = client->get_chain()->get_slot_signee( next_slot_time, active_delegates );
    const auto next_signee_name = next_slot_signee.name;

    const auto asset_record = client->get_chain()->get_asset_record( asset_id_type() );
    FC_ASSERT( asset_record.valid() );
    const auto share_supply = asset_record->current_share_supply;

    for( const auto& delegate_record : delegate_records )
    {
        out << std::setw(  6 ) << delegate_record.id;

        const auto delegate_name = delegate_record.name;
        if( delegate_name != next_signee_name )
            out << std::setw( 32 ) << pretty_shorten( delegate_name, 31 );
        else
            out << std::setw( 32 ) << pretty_shorten( delegate_name, 29 ) + " *";

        out << std::setw( 15 ) << pretty_percent( delegate_record.net_votes(), share_supply, 10 );

        const auto num_produced = delegate_record.delegate_info->blocks_produced;
        const auto num_missed = delegate_record.delegate_info->blocks_missed;
        out << std::setw(  9 ) << num_produced;
        out << std::setw(  9 ) << num_missed;
        out << std::setw( 14 ) << pretty_percent( num_produced, num_produced + num_missed, 2 );

        out << std::setw(  9 ) << pretty_percent( delegate_record.delegate_info->pay_rate, 100, 0 );
        const auto pay_balance = asset( delegate_record.delegate_info->pay_balance );
        out << std::setw( 20 ) << client->get_chain()->to_pretty_asset( pay_balance );

        const auto last_block = delegate_record.delegate_info->last_block_num_produced;
        out << std::setw( 10 ) << ( last_block > 0 ? std::to_string( last_block ) : "NONE" );

        out << "\n";
    }

    return out.str();
}