Пример #1
0
void display_bench_result(int id)
{
    int row = BENCH_RESULT_STARTROW;
    Bench* bench = benches+id;
    unsigned long size;
    unsigned long duration_usec;
    unsigned long cycles = bench->cycles;
    unsigned long mb_per_sec_100; // MB/sec * 100

    duration_usec = sc_tmr_tick2usec(cycles);

    /* Avoid divide by zero error. */
    if(cycles == 0) cycles = 1;

    /* Compute speed in several units. */
    size = bench->sz;

    mb_per_sec_100 = size;
    mb_per_sec_100 *= 1000;
    mb_per_sec_100 /= 1024;
    mb_per_sec_100 *= 1000;
    mb_per_sec_100 /= duration_usec;
    mb_per_sec_100 *= 100;
    mb_per_sec_100 /= 1024;

    /* Display benchmark results. */
    conio_printf(2, row++, COLOR_WHITE, "Name   : %s", bench->name);
    conio_printf(2, row++, COLOR_WHITE, "Adr:0x%08X[%d], Sz:%7u KB", (int)(bench->adr), bench->u, size>>10);
    conio_printf(2, row++, COLOR_WHITE, "Cycles : %5u (%6u.%03u msec)", bench->cycles, duration_usec/1000, duration_usec%1000);
    conio_printf(2, row++, COLOR_WHITE, "Speed  : %5u.%02u MB/sec", mb_per_sec_100/100, mb_per_sec_100%100);
}
Пример #2
0
/* Stuff in order to edit benchmark settings. */
void display_bench_settings(int id)
{
    int row = 23;
    /* Display informations about settings. */
    conio_printf(2, row++, COLOR_SILVER, "Test pattern    : %s", pattern_names[test_pattern]);
    conio_printf(2, row++, COLOR_SILVER, "Hexedit on error: %s", hexedit_on_error ? "yes" : "no ");
}
Пример #3
0
void test_builtin(int argc, char **argv) {
    int i;

    conio_printf("You passed %d args:\n", argc);

    for(i = 0; i < argc; i++)
        conio_printf("%s\n", argv[i]);
}
Пример #4
0
static void * kosh_thread(void *p) {
	conio_printf("  **** KOSH, The KallistiOS Shell ****\n");
	kosh_chdir("/");
	while (kosh_exit == KE_NO)
		input_oneloop();
	conio_printf("Kosh is done\n");
	kosh_exit = KE_QUITTING;

	return NULL;
}
Пример #5
0
void bench_display_clear(void)
{
    int i;
    for(i=4; i<27; i++)
    {
        conio_printf(2, i, COLOR_WHITE, empty_line);
    }
}
Пример #6
0
/* get all our abi's and then start our main loop */
int main(int argc, char **argv) {
    pvr_init_defaults();

    printf("kosh starting\n");

    /* initalize the conio service */
    //conio_init(CONIO_TTY_PVR, CONIO_INPUT_LINE);
    conio_init(CONIO_TTY_SERIAL, CONIO_INPUT_LINE);

    conio_printf("   **** KOSH v1.4, The KallistiOS Shell ****\n");

    /* change directory to the default */
    chdir("/");

    /* this is the meat */
    while (!kosh_exit)
        input_oneloop();

    /* shutdown console i/o */
    conio_shutdown();

    printf("kosh is done\n");
    return 0;
}
Пример #7
0
void benchmark(void)
{
    unsigned long i;
    int row, col;

    menu_settings_t* mset   = &_menu_settings;
    menu_items_t   * mitems = &_menu_items;
    int menu_selected;

    /* Init timer stuff. */
    sc_tmr_start();

    menu_reset_settings(mset);
    menu_reset_items(mitems);
    menu_set_title(mset, "Saturn Memory Benchmark");

    menu_set_item(mitems, 0/*id*/, "Start Benchmarking    ", 0/*tag*/);
    menu_set_item(mitems, 1/*id*/, "Init DRAM             ", 1/*tag*/);
    menu_set_item(mitems, 2/*id*/, "Select test pattern   ", 2/*tag*/);
    menu_set_item(mitems, 3/*id*/, "Hexedit on error      ", 3/*tag*/);

    menu_set_pos(mset, -1/*x0*/, MENU_TOP_ROW/*y0*/, 30/*w*/, 7/*h*/, 1/*cols*/);
    menu_set_erase_on_exit(mset, 0);
    menu_set_callback_redraw(mset, display_bench_settings);

    menu_selected = 0;
    do
    {
        menu_selected = menu_start(mitems, mset, menu_selected/*selected_tag*/);
        if(mset->exit_code == MENU_EXIT_CANCEL)
        {
            return;
        }

        switch(menu_selected)
        {
        default:
        case(0):
            break;

        case(1):
            menu_clear_display(mset);
            my_RB_CartRAM_init(0/*CS0*/);
            bench_display_clear();
            break;

        case(2):
            test_pattern = (test_pattern+1)%PATTERN_CNT;
            break;

        case(3):
            hexedit_on_error = hexedit_on_error ? 0 : 1;
            break;
        }
    } while(menu_selected != 0);

    /* User requested benchmark start, so clear settings menu. */
    menu_clear_display(mset);


    /* Execute benchmarks. */
    bench_display_clear();
    row = 5, col = 2;
    for(i = 0; i < nBenches; i++)
    {
        unsigned short color;

        conio_printf(2, 4, COLOR_GREEN, "[%3d%%]Benchmarking \"%s\" ...", (100*i)/nBenches, benches[i].name);

        /* Perform bench. */
        benches[i].function(benches + i);

        /* Display some data in order to keep user waiting ... */
        display_bench_result(i);

        color = benches[i].status ? COLOR_YELLOW : COLOR_RED;
        conio_printf(col+ 0, row, color, "%s", benches[i].name);
        if(col==2)
        {
            col = 9;
        }
        else if(col==9)
        {
            col = 16;
        }
        else if(col==16)
        {
            col = 23;
        }
        else if(col==23)
        {
            col = 30;
        }
        else
        {
            col = 2;
            row++;
        }

        if(row >= BENCH_RESULT_STARTROW)
        {
            bench_display_clear();
            row = 5;
            col = 2;
        }
    }

prompt_start();//TMP?
    /* Display benchmark results. */
    bench_display_clear();

    menu_reset_settings(mset);
    menu_reset_items(mitems);
    menu_set_title(mset, "Benchmark Results");

    menu_set_pos(mset, -1/*x0*/, MENU_TOP_ROW/*y0*/, 30/*w*/, 12/*h*/, 1/*cols*/);
    menu_set_erase_on_exit(mset, 1);

    menu_set_features(mset, MENU_FEATURES_TEXTCENTER);
    menu_set_callback_getstr(mset, get_bench_name);
    menu_set_callback_redraw(mset, display_bench_result);

    menu_selected = 0;
    menu_selected = menu_list_start(NULL/*Items Array*/, nBenches, mset, menu_selected, NULL/*selection*/);
}