7 SerialUSB.begin(115200);
14 SerialUSB.write(
"Hello!\n");
15 unsigned long StartTime;
16 unsigned long CurrentTime;
17 unsigned long ElapsedTime;
19 const uint16_t baseStrRepetion = 48;
20 const uint32_t baseStrSize = 64;
21 const uint32_t newStrSize = ((baseStrSize - 1)*baseStrRepetion) + 1;
22 uint32_t numIterations = 4096;
24 char baseStr[baseStrSize] =
"abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\n";
25 char newStr[newStrSize];
29 for(j = 0; j < (newStrSize - 1); ++j)
31 newStr[j] = baseStr[k];
33 if(k == (baseStrSize - 1))
39 newStr[newStrSize - 1] =
'\0';
41 SerialUSB.write(
"Measuring time for new string:\n");
45 for(uint32_t
i = 0;
i< numIterations; ++
i){
46 SerialUSB.write(newStr);
48 CurrentTime = micros();
49 ElapsedTime = CurrentTime - StartTime;
50 SerialUSB.print(newStrSize * numIterations);
51 SerialUSB.print(
" characters in microSeconds = ");
52 SerialUSB.println(ElapsedTime);
static void createDefiniteString(char *newStr)
static void createRandomString(uint32_t size, char *newStr)