Exemplo n.º 1
0
/**
 * Builds the output text.
 */
void profile_dump_output()
{
    if (Cmdline_frame_profile) {
        end_profile_time = timer_get_microseconds();

        if (Cmdline_profile_write_file)
        {
            profiling_file << end_profile_time << ";" << (end_profile_time - start_profile_time) << std::endl;
        }

        profile_output.clear();
        profile_output += "  Avg :  Min :  Max :   # : Profile Name\n";
        profile_output += "----------------------------------------\n";

        for(int i = 0; i < (int)samples.size(); i++) {
            uint64_t sample_time;
            float percent_time, avg_time, min_time, max_time;
            uint64_t avg_micro_seconds, min_micro_seconds, max_micro_seconds;

            Assert(samples[i].open_profiles == 0);

            sample_time = samples[i].accumulator - samples[i].children_sample_time;

            if (end_profile_time == start_profile_time) {
                percent_time = 0.0f;
            } else {
                percent_time = (i2fl(sample_time) / i2fl(end_profile_time - start_profile_time)) *100.0f;
            }

            avg_micro_seconds = min_micro_seconds = max_micro_seconds = sample_time;
            avg_time = min_time = max_time = percent_time;

            // add new measurement into the history and get avg, min, and max
            store_profile_in_history(samples[i].name, percent_time, sample_time);
            get_profile_from_history(samples[i].name, &avg_time, &min_time, &max_time, &avg_micro_seconds, &min_micro_seconds, &max_micro_seconds);

            // format the data
            char avg[64], min[64], max[64], num[64];

            sprintf(avg, "%3.1f%% (%3.1fms)", avg_time, i2fl(avg_micro_seconds)*0.001f);
            sprintf(min, "%3.1f%% (%3.1fms)", min_time, i2fl(min_micro_seconds)*0.001f);
            sprintf(max, "%3.1f%% (%3.1fms)", max_time, i2fl(max_micro_seconds)*0.001f);
            sprintf(num, "%3d", samples[i].profile_instances);

            SCP_string indented_name(samples[i].name);

            for(uint indent = 0; indent < samples[i].num_parents; indent++) {
                indented_name = ">" + indented_name;
            }

            char line[256];
            sprintf(line, "%5s : %5s : %5s : %3s : ", avg, min, max, num);

            profile_output += line + indented_name + "\n";
        }

        samples.clear();
        start_profile_time = timer_get_microseconds();
    }
}
Exemplo n.º 2
0
void dc_init(void)
{
	if (debug_inited) {
		return;
	}

	debug_inited = TRUE;

	// Init window settings
	dc_font = FONT1;
	row_height = ((Current_font->h) * 3) / 2;	// Row/Line height, in pixels
	col_width = Current_font->w;			// Col/Character width, in pixels
	dc_scroll_x = 0;
	dc_scroll_y = 0;
	DCOLS = (gr_screen.max_w / col_width) - 1;	// Subtract as needed. Windowed mode has some quirks with the resolution
	DROWS = (gr_screen.max_h / row_height) - 2;
	DBCOLS = DCOLS;
	DBROWS = 2 * DROWS;

	// Init History
	dc_history.clear();
	dc_history.push_back("");
	last_oldcommand = dc_history.begin();

	// Init buffers
	dc_buffer.clear();
	dc_buffer.push_back("");
	
	dc_command_buf.reserve(MAX_CLI_LEN);
	dc_command_buf.clear();

	sprintf(dc_title, "FreeSpace Open v%i.%i.%i", FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD);
	dc_printf("Debug console started.\n" );
}
Exemplo n.º 3
0
void dc_init(void)
{
	if (debug_inited) {
		return;
	}

	debug_inited = TRUE;

	// Init window settings
	dc_font = font::FONT1;
	row_height = ((fl2i(font::get_current_font()->getHeight())) * 3) / 2;	// Row/Line height, in pixels

	// This assumes that FONT1 is monospaced!
	gr_get_string_size(&col_width, nullptr, " "); // Col/Character width, in pixels

	dc_scroll_x = 0;
	dc_scroll_y = 0;
	DCOLS = (gr_screen.center_w / col_width) - 1;	// Subtract as needed. Windowed mode has some quirks with the resolution
	DROWS = (gr_screen.center_h / row_height) - 2;
	DBCOLS = DCOLS;
	DBROWS = 2 * DROWS;

	// Init History
	dc_history.clear();
	dc_history.push_back("");
	last_oldcommand = dc_history.begin();

	// Init buffers
	dc_buffer.clear();
	dc_buffer.push_back("");
	
	dc_command_buf.reserve(MAX_CLI_LEN);
	dc_command_buf.clear();

	sprintf(dc_title, "FreeSpace Open v%i.%i.%i", FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD);
	dc_printf("Debug console started.\n" );
}