|
Last change
on this file was
11060,
checked in by westram, 12 years ago
|
- reintegrates 'ptsfix' into 'trunk':
- adds:
- log:branches/ptsdump@8966:9000
- log:branches/ptsfix@8965:9012,9014:9017,9019:9023,9025:9046,9048:9089,9091:9114,9116:9132,9134:9139,9141:9145,9147:9151,9153:9158,9160:9379,9381:11059
- log:branches/ptsstartup@9160:9235,9237:9278,9280:9336,9339:9361,9363:9446
- log:branches/ptsundef@9061:9358
|
|
File size:
1.6 KB
|
| Line | |
|---|
| 1 | // ================================================================ // |
|---|
| 2 | // // |
|---|
| 3 | // File : arb_flush_mem.cxx // |
|---|
| 4 | // Purpose : // |
|---|
| 5 | // // |
|---|
| 6 | // Coded by Ralf Westram (coder@reallysoft.de) in December 2012 // |
|---|
| 7 | // Institute of Microbiology (Technical University Munich) // |
|---|
| 8 | // http://www.arb-home.de/ // |
|---|
| 9 | // // |
|---|
| 10 | // ================================================================ // |
|---|
| 11 | |
|---|
| 12 | #include <arbdb.h> |
|---|
| 13 | #include <arb_misc.h> |
|---|
| 14 | #include <arb_progress.h> |
|---|
| 15 | |
|---|
| 16 | int ARB_main(int , char *[]) { |
|---|
| 17 | GB_ULONG blocks_to_flush = GB_get_usable_memory()*4; // no of 256b-blocks |
|---|
| 18 | GB_ULONG mem_to_flush = blocks_to_flush*256; |
|---|
| 19 | printf("Flushing %s of your memory\n", GBS_readable_size(mem_to_flush, "b")); |
|---|
| 20 | |
|---|
| 21 | unsigned char *mem = (unsigned char *)malloc(mem_to_flush); |
|---|
| 22 | { |
|---|
| 23 | arb_progress progress("writing mem", blocks_to_flush); |
|---|
| 24 | for (GB_ULONG p = 0; p<mem_to_flush; ++p) { |
|---|
| 25 | mem[p] = (unsigned char)p; |
|---|
| 26 | if (!mem[p]) ++progress; |
|---|
| 27 | } |
|---|
| 28 | } |
|---|
| 29 | #if 0 |
|---|
| 30 | ulong sum = 0; |
|---|
| 31 | { |
|---|
| 32 | arb_progress progress("reading mem", blocks_to_flush); |
|---|
| 33 | for (GB_ULONG p = 0; p<mem_to_flush; ++p) { |
|---|
| 34 | sum += mem[p]; |
|---|
| 35 | if (!mem[p]) ++progress; |
|---|
| 36 | } |
|---|
| 37 | } |
|---|
| 38 | printf("done with sum=%lu\n", sum); |
|---|
| 39 | #endif |
|---|
| 40 | |
|---|
| 41 | free(mem); |
|---|
| 42 | |
|---|
| 43 | return EXIT_SUCCESS; |
|---|
| 44 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.