Files correlati : ba0.exe ba1.exe ba0200a.msk Ricompilazione Demo : [ ] Commento : ba0, ba0200a.msk: aggiunta la possibilita' di escludere le immagini di sfondo per velocizzare navigazione menu su macchhine lente o in teleassistenza ba1, ba0close: aggiunto il supporto per l'aggiornamento delle DLL git-svn-id: svn://10.65.10.50/trunk@11186 c028cbd2-c16b-5b4b-a496-9718f37d4682
152 lines
3.1 KiB
C++
Executable File
152 lines
3.1 KiB
C++
Executable File
#include <time.h>
|
|
|
|
#include <applicat.h>
|
|
#include <progind.h>
|
|
#include <relation.h>
|
|
#include <urldefid.h>
|
|
|
|
///////////////////////////////////////////////////////////
|
|
// Testfile
|
|
///////////////////////////////////////////////////////////
|
|
|
|
class TTest_application : public TSkeleton_application
|
|
{
|
|
protected:
|
|
void test1();
|
|
void test2();
|
|
void test3();
|
|
|
|
clock_t start_timer() const;
|
|
|
|
public:
|
|
virtual void main_loop();
|
|
};
|
|
|
|
clock_t TTest_application::start_timer() const
|
|
{
|
|
clock_t t, s = clock();
|
|
do
|
|
t = clock();
|
|
while (t == s);
|
|
return t;
|
|
}
|
|
|
|
void TTest_application::test1()
|
|
{
|
|
TLocalisamfile tab(LF_COMUNI);
|
|
const TRecnotype n = tab.items();
|
|
|
|
clock_t start;
|
|
TRecnotype r = 0;
|
|
TString80 msg;
|
|
{
|
|
const int times = 10;
|
|
TProgind p(times, TR("Lettura file comuni"), TRUE, TRUE);
|
|
start = start_timer();
|
|
for (int i = 0; i < times; i++)
|
|
{
|
|
for (tab.first(); tab.good(); tab.next())
|
|
r++;
|
|
|
|
msg.format("%ld records %ld msec", r, clock() - start);
|
|
p.addstatus(1);
|
|
p.set_text(msg);
|
|
if (p.iscancelled())
|
|
break;
|
|
}
|
|
}
|
|
const clock_t t = clock() - start;
|
|
msg.format("%ld records in %ld msec\n%lg records per sec", r, t, 1000.0*r/t);
|
|
message_box(msg);
|
|
}
|
|
|
|
void TTest_application::test2()
|
|
{
|
|
TRelation rel(LF_COMUNI);
|
|
TCursor tab(&rel);
|
|
|
|
const TRecnotype n = tab.items();
|
|
|
|
tab.freeze();
|
|
|
|
clock_t start;
|
|
TRecnotype r = 0;
|
|
TString80 msg;
|
|
{
|
|
const int times = 10;
|
|
TProgind p(times, TR("Lettura cursore comuni"), TRUE, TRUE);
|
|
start = start_timer();
|
|
for (int i = 0; i < times; i++)
|
|
{
|
|
for (tab = 0; tab.pos() < n; ++tab)
|
|
r++;
|
|
|
|
msg.format("%ld records %ld msec", r, clock() - start);
|
|
p.addstatus(1);
|
|
p.set_text(msg);
|
|
if (p.iscancelled())
|
|
break;
|
|
}
|
|
}
|
|
const clock_t t = clock() - start;
|
|
msg.format("%ld records in %ld msec\n%lg records per sec\n",
|
|
r, t, 1000.0*r/t);
|
|
message_box(msg);
|
|
}
|
|
|
|
void TTest_application::test3()
|
|
{
|
|
TRelation rel(LF_COMUNI);
|
|
TSorted_cursor tab(&rel, "CAPCOM|DENCOM");
|
|
|
|
clock_t istart = start_timer();
|
|
const TRecnotype n = tab.items();
|
|
clock_t istop = clock() - istart;
|
|
|
|
tab.freeze();
|
|
|
|
clock_t start;
|
|
TRecnotype r = 0;
|
|
TString256 msg;
|
|
{
|
|
const int times = 10;
|
|
TProgind p(times, TR("Lettura cursore C.A.P."), TRUE, TRUE);
|
|
start = start_timer();
|
|
for (int i = 0; i < times; i++)
|
|
{
|
|
for (tab = 0; tab.pos() < n; ++tab)
|
|
r++;
|
|
|
|
msg.format("%ld records %ld msec", r, clock() - start);
|
|
p.addstatus(1);
|
|
p.set_text(msg);
|
|
if (p.iscancelled())
|
|
break;
|
|
}
|
|
}
|
|
const clock_t t = clock() - start;
|
|
msg.format("%ld records in %ld msec\n%lg records per sec\n"
|
|
"%ld msec for initialization",
|
|
r, t, 1000.0*r/t, istop);
|
|
message_box(msg);
|
|
}
|
|
|
|
|
|
void TTest_application::main_loop()
|
|
{
|
|
test1();
|
|
test2();
|
|
test3();
|
|
}
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
int ba1200(int argc, char** argv)
|
|
{
|
|
TTest_application a;
|
|
a.run(argc, argv, TR("Test File"));
|
|
return 0;
|
|
}
|
|
|