/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*- /* test CPU speed Andrew Tridgell September 2011 */ #include #include FastSerialPort0(Serial); #define SERIAL0_BAUD 115200 void setup() { Serial.begin(SERIAL0_BAUD, 128, 128); } static void show_sizes(void) { Serial.println("Type sizes:"); Serial.printf("char : %d\n", sizeof(char)); Serial.printf("short : %d\n", sizeof(short)); Serial.printf("int : %d\n", sizeof(int)); Serial.printf("long : %d\n", sizeof(long)); Serial.printf("long long : %d\n", sizeof(long long)); Serial.printf("bool : %d\n", sizeof(bool)); Serial.printf("void* : %d\n", sizeof(void *)); } #define TENTIMES(x) do { x; x; x; x; x; x; x; x; x; x; } while (0) #define FIFTYTIMES(x) do { TENTIMES(x); TENTIMES(x); TENTIMES(x); TENTIMES(x); TENTIMES(x); } while (0) #define TIMEIT(name, op, count) do { \ uint32_t us_end, us_start; \ us_start = micros(); \ for (uint8_t i=0; i