Преглед на файлове

Faster SdBaseFile::printField()

main
Bill Greiman преди 10 години
родител
ревизия
565b3eae42
променени са 3 файла, в които са добавени 37 реда и са изтрити 13 реда
  1. +4
    -0
      SdFat/SdBaseFilePrint.cpp
  2. +29
    -13
      SdFat/examples/PrintBenchmark/PrintBenchmark.ino
  3. +4
    -0
      changes.txt

+ 4
- 0
SdFat/SdBaseFilePrint.cpp Целия файл

*--str = '\r'; *--str = '\r';
} }
} }
#ifdef OLD_FMT
do { do {
Type m = value; Type m = value;
value /= 10; value /= 10;
*--str = '0' + m - 10*value; *--str = '0' + m - 10*value;
} while (value); } while (value);
#else // OLD_FMT
str = fmtDec(value, str);
#endif // OLD_FMT
if (sign) { if (sign) {
*--str = sign; *--str = sign;
} }

+ 29
- 13
SdFat/examples/PrintBenchmark/PrintBenchmark.ino Целия файл



cout << pstr("Type is FAT") << int(sd.vol()->fatType()) << endl; cout << pstr("Type is FAT") << int(sd.vol()->fatType()) << endl;


// open or create file - truncate existing file.
if (!file.open("BENCH.TXT", O_CREAT | O_TRUNC | O_RDWR)) {
error("open failed");
}
cout << pstr("Starting print test. Please wait.\n\n"); cout << pstr("Starting print test. Please wait.\n\n");


// do write test // do write test
for (int test = 0; test < 3; test++) {

for (int test = 0; test < 5; test++) {
char fileName[13] = "BENCH0.TXT";
fileName[5] = '0' + test;
// open or create file - truncate existing file.
if (!file.open(fileName, O_CREAT | O_TRUNC | O_RDWR)) {
error("open failed");
}
maxLatency = 0;
minLatency = 999999;
totalLatency = 0;
switch(test) { switch(test) {
case 0: case 0:
cout << pstr("Test of println(uint16_t)\n"); cout << pstr("Test of println(uint16_t)\n");
break; break;


case 2: case 2:
cout << pstr("Test of println(double)\n");
cout << pstr("Test of println(uint32_t)\n");
break; break;
case 3:
cout << pstr("Test of printField(uint32_t, char)\n");
break;
case 4:
cout << pstr("Test of println(double)\n");
break;
} }
file.truncate(0);
maxLatency = 0;
minLatency = 999999;
totalLatency = 0;
uint32_t t = millis(); uint32_t t = millis();
for (uint16_t i = 0; i < N_PRINT; i++) { for (uint16_t i = 0; i < N_PRINT; i++) {
uint32_t m = micros(); uint32_t m = micros();
break; break;


case 2: case 2:
file.println(12345678UL + i);
break;
case 3:
file.printField(12345678UL + i, '\n');
break;
case 4:
file.println((double)0.01*i); file.println((double)0.01*i);
break; break;
} }
if (minLatency > m) minLatency = m; if (minLatency > m) minLatency = m;
totalLatency += m; totalLatency += m;
} }
file.sync();
file.close();
t = millis() - t; t = millis() - t;
double s = file.fileSize(); double s = file.fileSize();
cout << pstr("Time ") << 0.001*t << pstr(" sec\n"); cout << pstr("Time ") << 0.001*t << pstr(" sec\n");
cout << pstr(" usec, Avg Latency: "); cout << pstr(" usec, Avg Latency: ");
cout << totalLatency/N_PRINT << pstr(" usec\n\n"); cout << totalLatency/N_PRINT << pstr(" usec\n\n");
} }
file.close();
cout << pstr("Done!\n\n"); cout << pstr("Done!\n\n");
} }



+ 4
- 0
changes.txt Целия файл

05 Sep 2014

Faster SdBaseFile::printField();

24 Aug 2014 24 Aug 2014


Added support for Software SPI on Due and Teensy 3.1 Added support for Software SPI on Due and Teensy 3.1

Loading…
Отказ
Запис