Changeset 589:6fed7fee381f

Show
Ignore:
Timestamp:
06/08/08 00:38:25 (7 months ago)
Author:
Maxime Petazzoni <maxime.petazzoni@…>
Branch:
default
Message:

Add defrag and FS stats function for testing.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • nxos/systems/tag-route/main.c

    r584 r589  
    2727void record(char *filename); 
    2828void replay(char *filename); 
     29void defrag(void); 
    2930 
    3031void record(char *filename) { 
     
    8283} 
    8384 
     85void defrag(void) { 
     86  nx_display_clear(); 
     87  nx_display_string("- Defrag -\n\n"); 
     88  nx_fs_defrag_best_overall(); 
     89  nx_display_string("Done.\n"); 
     90} 
     91 
     92void stats(void) { 
     93  U32 files = 0, used = 0, free_pages = 0, wasted = 0; 
     94 
     95  nx_display_clear(); 
     96  nx_display_string("- FS stats -\n\n"); 
     97 
     98  nx_fs_get_occupation(&files, &used, &free_pages, &wasted); 
     99 
     100  nx_display_uint(files); 
     101  nx_display_string(" file(s).\n"); 
     102 
     103  nx_display_uint(used); 
     104  nx_display_string("B used.\n"); 
     105 
     106  nx_display_uint(free_pages); 
     107  nx_display_string(" free page(s).\n"); 
     108 
     109  nx_display_uint(wasted); 
     110  nx_display_string("B wasted.\n"); 
     111} 
     112 
    84113void main(void) { 
    85   char *entries[] = {"Replay", "Record", "--", "Halt", NULL}; 
     114  char *entries[] = {"Replay", "Record", "Stats", "Defrag", "Halt", NULL}; 
    86115  gui_text_menu_t menu; 
    87116  U8 res; 
     
    105134        record(ROUTE_FILE); 
    106135        break; 
     136      case 2: 
     137        stats(); 
     138        break; 
     139      case 3: 
     140        defrag(); 
     141        break; 
    107142      default: 
    108143        continue;