GY-63_MS5611/libraries/Set/examples/timingTest/timingTest.ino

82 lines
1.6 KiB
Arduino
Raw Normal View History

2020-11-27 05:33:55 -05:00
//
// FILE: timingTest.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.1
// PURPOSE: timing test for set class methods
// DATE: 2014-11-09
// URL: https://github.com/RobTillaart/SET
//
// Released to the public domain
//
#include "set.h"
Set myset;
Set setA, setB;
uint32_t start;
uint32_t stop;
volatile bool b;
void setup()
{
Serial.begin(115200);
Serial.print("Start set_demo : ");
Serial.println(SET_LIB_VERSION);
Serial.println();
Serial.println("\n\ntiming test");
Serial.print("myset.clr():\t");
start = micros();
myset.clr();
stop = micros();
Serial.println(stop - start);
Serial.print("myset.add():\t");
start = micros();
for (int i = 0; i < 256; i++) myset.add(i);
stop = micros();
Serial.println(stop - start);
Serial.print("myset.sub():\t");
start = micros();
for (int i = 0; i < 256; i++) myset.sub(i);
stop = micros();
Serial.println(stop - start);
Serial.print("myset.has():\t");
start = micros();
for (int i = 0; i < 256; i++) b = myset.has(i);
stop = micros();
Serial.println(stop - start);
Serial.print("myset.invert(v):\t");
start = micros();
for (int i = 0; i < 256; i++) myset.invert(i);
stop = micros();
Serial.println(stop - start);
Serial.print("myset.invert():\t");
start = micros();
myset.invert();
stop = micros();
Serial.println(stop - start);
Serial.print("myset.count():\t");
start = micros();
myset.count();
stop = micros();
Serial.println(stop - start);
Serial.println();
Serial.println("done...");
Serial.println();
}
void loop()
{
}