#include <stdio.h>
#include "example_fcns.h"
#include "core23_structs.h"
#include "core23_cat.h"
const char *const description =
"Performance Test: reading/deleting in key order";
{
SIMPLE simple_rec = {0};
perfTimer_t timer;
timeMeasureBegin (&timer);
print_error (rc);
{
for (int ii = 0; ii < 50000; ii++)
{
simple_rec.int_col = 1;
hDB, TABLE_SIMPLE, &simple_rec, sizeof (simple_rec), NULL);
print_error (rc);
}
}
timeMeasureEnd (&timer);
printf (
"Add 50,000 records:\t\t\t\t%u milliseconds\n",
timeMeasureDiff (&timer));
return rc;
}
{
SIMPLE simple_rec;
perfTimer_t timer;
unsigned int total = 0;
timeMeasureBegin (&timer);
print_error (rc);
{
print_error (rc);
{
print_error (rc);
{
{
cursor, &simple_rec, sizeof (simple_rec), NULL);
print_error (rc);
{
total += simple_rec.int_col;
}
}
}
}
}
timeMeasureEnd (&timer);
{
printf (
"Scanning, reading, summing 50,000 records:\t%u milliseconds\n",
timeMeasureDiff (&timer));
printf ("\tSum = %u\n", total);
}
return rc;
}
{
SIMPLE simple_rec;
perfTimer_t timer;
timeMeasureBegin (&timer);
print_error (rc);
{
print_error (rc);
{
print_error (rc);
{
{
cursor, &simple_rec, sizeof (simple_rec), NULL);
print_error (rc);
{
simple_rec.int_col++;
cursor, &simple_rec, sizeof (simple_rec));
print_error (rc);
}
}
}
}
}
timeMeasureEnd (&timer);
{
printf (
"Updating 50,000 records:\t\t\t%u milliseconds\n",
timeMeasureDiff (&timer));
}
return rc;
}
{
perfTimer_t timer;
timeMeasureBegin (&timer);
print_error (rc);
{
print_error (rc);
{
{
print_error (rc);
}
}
}
timeMeasureEnd (&timer);
{
printf (
"Deleting 50,000 records:\t\t\t%u milliseconds\n",
timeMeasureDiff (&timer));
}
return rc;
}
int main_core23 (int argc, const char *const *argv)
{
perfTimer_t timer;
print_error (rc);
{
timeMeasureBegin (&timer);
rc = exampleOpenEmptyDatabase (&hTFS, &hDB, "core23", core23_cat);
timeMeasureEnd (&timer);
{
printf (
"Preparing a new database:\t\t\t%u milliseconds\n",
timeMeasureDiff (&timer));
printf ("\tOne, simple record type.\n");
printf ("\tOn-Disk\n");
}
{
rc = add_records (hDB);
{
rc = read_records (hDB);
{
rc = update_records (hDB);
{
rc = read_records (hDB);
{
rc = delete_records (hDB);
}
}
}
}
timeMeasureBegin (&timer);
exampleCleanup (hTFS, hDB);
timeMeasureEnd (&timer);
printf (
"Cleanup:\t\t\t\t\t%u milliseconds\n",
timeMeasureDiff (&timer));
}
}
return (int) rc;
}