@@ 1977,12 1977,9 @@ static int load_index(void)
static void print_stats(void)
{
- struct index_iter_ctx ctx;
struct xlua_state *lua;
lua_State *L;
- struct qso *qso;
char error[128];
- bool failed;
int ret;
printf("Global call statistics:\n");
@@ 1995,21 1992,6 @@ static void print_stats(void)
L = xlua_lock(lua);
- /* iterate over all the QSOs */
- for (qso = index_iter_history_start(&ctx, true), failed = false;
- qso;
- qso = index_iter_history_next(&ctx)) {
- ret = xlua_qso_call(L, "summarize_qso", qso_getref(qso),
- true, error, sizeof(error));
- if (ret) {
- printf("Error: failed to execute lua: %s\n", error);
- failed = true;
- }
- }
-
- if (failed)
- printf("Warning: incomplete stats due to errors\n");
-
/* print stats */
ret = xlua_call(L, "print_summary", 0, 0, error, sizeof(error));
if (ret)
@@ 40,7 40,7 @@ local function init_mode_band(mode, band
band_names[band] = band
end
-function summarize_qso(qso)
+local function summarize_qso(qso)
local mode = qso.tx.mode
local band = qso.tx.band
@@ 78,6 78,10 @@ end
function print_summary()
local out
+ for qso in hlog.index.history(true) do
+ summarize_qso(qso)
+ end
+
-- order the band names
local band_name_array = {}
for band, dummy in pairs(band_names) do