git-svn-id: svn://10.65.10.50/branches/R_10_00@23148 c028cbd2-c16b-5b4b-a496-9718f37d4682

This commit is contained in:
guy 2015-12-16 15:49:36 +00:00
parent 941d28df75
commit ed68f81ed7
3 changed files with 88 additions and 8 deletions

View File

@ -802,7 +802,7 @@ void TManutenzione_app::repair_file(int i)
FOR_EACH_TOKEN(names, name) FOR_EACH_TOKEN(names, name)
xvt_fsys_remove_file(name); xvt_fsys_remove_file(name);
s.format(FR("File n. %d - %s : eliminato file errato"), i, n); s.format(FR("File n.%d - %s : eliminato file errato"), i, n);
write_log(s, 2); write_log(s, 2);
} }
else else
@ -820,14 +820,17 @@ void TManutenzione_app::repair_file(int i)
const int reclen = rec.len(); const int reclen = rec.len();
d.set_len(reclen); d.set_len(reclen);
d.put(i, _nordir, _sysdirop); d.put(i, _nordir, _sysdirop);
s.format(FR("File n. %d - %s : corretto tracciato da %d a %d bytes"), i, n, oldreclen, reclen); if (oldreclen != reclen)
s.format(FR("File n.%d - %s : corretto tracciato da %d a %d bytes"), i, n, oldreclen, reclen);
else
s.format(FR("File n.%d - %s : Riparato tracciato record"), i, n);
write_log(s, 1); write_log(s, 1);
} }
} }
bool TManutenzione_app::moveable_file(int file) const bool TManutenzione_app::moveable_file(int file) const
{ {
return file == LF_PCON || file == LF_CLIFO || file == LF_CAUSALI || return file == LF_PCON || file == LF_CLIFO || file == LF_CAUSALI ||
file == LF_RCAUSALI || file == LF_CFVEN || file == LF_INDSP; file == LF_RCAUSALI || file == LF_CFVEN || file == LF_INDSP;
} }
@ -923,7 +926,7 @@ void TManutenzione_app::update_dir()
bool kill = true; bool kill = true;
//controllo solo all'aga //controllo solo all'aga
if (is_power_station()) if (is_power_station())
kill = yesno_box(FR("Il tracciato record del file %d e' incoerente:\n" kill = yesno_box(FR("Il tracciato record del file %d è incoerente:\n"
"Si desidera eliminare il file vuoto %s?"), i, (const char*)fs); "Si desidera eliminare il file vuoto %s?"), i, (const char*)fs);
if (kill) if (kill)
{ {
@ -1174,7 +1177,7 @@ void TManutenzione_app::convert_dir()
s << TR("ditta ") << atol (pref); s << TR("ditta ") << atol (pref);
s << ".\n"; s << ".\n";
TProgress_monitor p(update_items ? update_items : 1, s, is_power_station()); TProgress_monitor p(update_items, s, is_power_station());
for (int i = LF_USER; i <= update_items; i++) for (int i = LF_USER; i <= update_items; i++)
{ {
if (!p.add_status()) if (!p.add_status())
@ -1498,7 +1501,7 @@ void TManutenzione_app::update()
prefix().set(""); prefix().set("");
load_des(); load_des();
prefix().set_codditta(0L); prefix().set_codditta(0L); // COM
TString mxs; mxs = TR("Conversione dati comuni"); TString mxs; mxs = TR("Conversione dati comuni");
@ -1517,7 +1520,7 @@ void TManutenzione_app::update()
const long codditta = ditte.get_long(i); const long codditta = ditte.get_long(i);
if (codditta > _history_firm && prefix().exist(codditta) && set_firm(codditta)) if (codditta > _history_firm && prefix().exist(codditta) && set_firm(codditta))
{ {
mxs.cut(0) << TR("Conversione Ditta") << ' ' << codditta; mxs.cut(0) << TR("Conversione Ditta ") << codditta;
write_log(""); write_log("");
write_log(mxs); write_log(mxs);
write_log(""); write_log("");

View File

@ -2,6 +2,7 @@
#include <config.h> #include <config.h>
#include <dongle.h> #include <dongle.h>
#include <isam.h> #include <isam.h>
#include <mask.h>
#include <modaut.h> #include <modaut.h>
#include <prefix.h> #include <prefix.h>
#include <netsock.h> #include <netsock.h>

View File

@ -1,4 +1,5 @@
#include <applicat.h> #include <applicat.h>
#include <mask.h>
#include <progind.h> #include <progind.h>
#include <recarray.h> #include <recarray.h>
#include <relation.h> #include <relation.h>
@ -6,6 +7,7 @@
#include <toolfld.h> #include <toolfld.h>
#include <reputils.h> #include <reputils.h>
#include <urldefid.h> #include <urldefid.h>
#include <hashtable.h>
#include <comuni.h> #include <comuni.h>
@ -31,6 +33,7 @@ TProfiler_mask::TProfiler_mask() : TMask(TR("Test"), 1, 60, 20)
codes.add(5); items.add(TR("Lettura causale senza cache")); codes.add(5); items.add(TR("Lettura causale senza cache"));
codes.add(6); items.add(TR("Creazione e cancellazione records")); codes.add(6); items.add(TR("Creazione e cancellazione records"));
codes.add(7); items.add(TR("Creazione e cancellazione records in modo esclusivo")); codes.add(7); items.add(TR("Creazione e cancellazione records in modo esclusivo"));
codes.add(8); items.add(TR("Confronto TAssoc_array THash_table"));
add_radio (101, 0, TR("@bSelezione test"), 1, 1, 58, codes, items); add_radio (101, 0, TR("@bSelezione test"), 1, 1, 58, codes, items);
add_number(102, 0, PR("Numero di iterazioni"), 1, 0, 3, "U"); add_number(102, 0, PR("Numero di iterazioni"), 1, 0, 3, "U");
@ -57,6 +60,7 @@ protected:
bool test5(TLog_report& log); bool test5(TLog_report& log);
bool test6(TLog_report& log); bool test6(TLog_report& log);
bool test7(TLog_report& log); bool test7(TLog_report& log);
bool test8(TLog_report& log);
public: public:
bool test(int n, TLog_report& log); bool test(int n, TLog_report& log);
@ -402,6 +406,77 @@ bool TTest_application::test7(TLog_report& log)
return ok; return ok;
} }
bool TTest_application::test8(TLog_report& log)
{
static TArray parole(1024*1024);
if (parole.empty())
{
const clock_t start = start_progind(n, TR("Lettura big.txt con TArray"));
TString str;
ifstream big("recdesc/big.txt");
while (!big.eof())
{
big >> str;
if (str.full())
{
str.trim();
if (str.len() <= 16)
parole.add(new TString16(str));
else
parole.add(new TString80(str));
}
}
stop_progind();
}
TString msg;
const unsigned int n = parole.items();
bool ok = n > 0;
if (ok)
{
TAssoc_array ass;
const clock_t start = start_progind(n, TR("Lettura big.txt con TAssoc_array"));
FOR_EACH_ARRAY_ITEM(parole, r, o)
{
const TString& p = *(const TString*)o;
ass.add(p, p, false);
if ((r % 256 == 0) && !_pi->set_status(r+1))
{
ok = false;
break;
}
}
const clock_t t = stop_progind() - start;
msg.format("Lettura %ld parole in TAssoc_array %6ld msec - %5lg words per sec", n, t, 1000.0*n/t);
log.log(0, msg);
}
if (ok)
{
THash_table ash;
const clock_t start = start_progind(n, TR("Lettura big.txt con THash_table"));
FOR_EACH_ARRAY_ITEM(parole, r, o)
{
const TString& p = *(const TString*)o;
ash.add(p, p, false);
if ((r % 256 == 0) && !_pi->set_status(r+1))
{
ok = false;
break;
}
}
const clock_t t = stop_progind() - start;
msg.format("Lettura %ld parole in THash_table %6ld msec - %5lg words per sec", n, t, 1000.0*n/t);
log.log(0, msg);
}
if (!ok)
log.log(1, TR("Interrotto dall'utente"));
return ok;
}
bool TTest_application::test(int n, TLog_report& log) bool TTest_application::test(int n, TLog_report& log)
{ {
bool ok = false; bool ok = false;
@ -414,6 +489,7 @@ bool TTest_application::test(int n, TLog_report& log)
case 5: ok = test5(log); break; case 5: ok = test5(log); break;
case 6: ok = test6(log); break; case 6: ok = test6(log); break;
case 7: ok = test7(log); break; case 7: ok = test7(log); break;
case 8: ok = test8(log); break;
default: ok = false; break; default: ok = false; break;
} }
return ok; return ok;
@ -454,7 +530,7 @@ void TTest_application::main_loop()
TLog_report log(TR("Report")); TLog_report log(TR("Report"));
bool ok = true; bool ok = true;
for (int t = 1; ok && t <= 7; t++) for (int t = 1; ok && t <= 8; t++)
{ {
if (te <= 0 || te == t) if (te <= 0 || te == t)
{ {