mirror of https://github.com/gnosygnu/xowa
Make: Add xomp_stats to track time per page (and other attributes) [#456]
parent
5db81504fb
commit
cf94f252e9
@ -0,0 +1,106 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.addons.bldrs.mass_parses.dbs; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.mass_parses.*;
|
||||
import gplx.dbs.*;
|
||||
import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.hzips.*;
|
||||
import gplx.xowa.wikis.pages.*;
|
||||
import gplx.xowa.parsers.logs.stats.*;
|
||||
public class Xomp_stat_tbl implements Rls_able {
|
||||
private static final String tbl_name = "xomp_stats"; private static final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
private static final String
|
||||
fld_page_id = flds.Add_int_pkey("page_id"), fld_wkr_uid = flds.Add_int("wkr_uid")
|
||||
, fld_wtxt_len = flds.Add_int("wtxt_len"), fld_html_len = flds.Add_int("html_len"), fld_zip_len = flds.Add_int("zip_len")
|
||||
, fld_page_time = flds.Add_long("page_time"), fld_tidy_time = flds.Add_long("tidy_time"), fld_fulltext_time = flds.Add_long("fulltext_time")
|
||||
, fld_scrib_time = flds.Add_long("scrib_time"), fld_scrib_count = flds.Add_int("scrib_count"), fld_scrib_depth = flds.Add_int("scrib_depth")
|
||||
, fld_image_count = flds.Add_int("image_count"), fld_audio_count = flds.Add_int("audio_count"), fld_video_count = flds.Add_int("video_count"), fld_media_count = flds.Add_int("media_count")
|
||||
, fld_lnki_count = flds.Add_int("lnki_count"), fld_lnke_count = flds.Add_int("lnke_count"), fld_hdr_count = flds.Add_int("hdr_count")
|
||||
, fld_math_count = flds.Add_int("math_count"), fld_imap_count = flds.Add_int("imap_count"), fld_hiero_count = flds.Add_int("hiero_count")
|
||||
, fld_gallery_count = flds.Add_int("gallery_count"), fld_gallery_packed_count = flds.Add_int("gallery_packed_count")
|
||||
;
|
||||
private final Db_conn conn; private Db_stmt stmt_insert;
|
||||
public Xomp_stat_tbl(Db_conn conn) {
|
||||
this.conn = conn;
|
||||
this.Create_tbl();
|
||||
conn.Stmt_delete(tbl_name).Exec_delete(); // always zap table
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds, Dbmeta_idx_itm.new_unique_by_tbl(tbl_name, "pkey", fld_page_id)));}
|
||||
public void Rls() {
|
||||
stmt_insert = Db_stmt_.Rls(stmt_insert);
|
||||
}
|
||||
public void Stmt_new() {
|
||||
stmt_insert = conn.Stmt_insert(tbl_name, flds);
|
||||
}
|
||||
public void Insert_by_copy(Db_rdr rdr) {
|
||||
stmt_insert.Clear()
|
||||
.Val_int (fld_page_id , rdr.Read_int(fld_page_id))
|
||||
.Val_int (fld_wkr_uid , rdr.Read_int(fld_wkr_uid))
|
||||
.Val_int (fld_wtxt_len , rdr.Read_int(fld_wtxt_len))
|
||||
.Val_int (fld_html_len , rdr.Read_int(fld_html_len))
|
||||
.Val_int (fld_zip_len , rdr.Read_int(fld_zip_len))
|
||||
.Val_long(fld_page_time , rdr.Read_long(fld_page_time))
|
||||
.Val_long(fld_tidy_time , rdr.Read_long(fld_tidy_time))
|
||||
.Val_long(fld_fulltext_time , rdr.Read_long(fld_fulltext_time))
|
||||
.Val_long(fld_scrib_time , rdr.Read_long(fld_scrib_time))
|
||||
.Val_int (fld_scrib_count , rdr.Read_int (fld_scrib_count))
|
||||
.Val_int (fld_scrib_depth , rdr.Read_int (fld_scrib_depth))
|
||||
.Val_int (fld_image_count , rdr.Read_int (fld_image_count))
|
||||
.Val_int (fld_audio_count , rdr.Read_int (fld_audio_count))
|
||||
.Val_int (fld_video_count , rdr.Read_int (fld_video_count))
|
||||
.Val_int (fld_media_count , rdr.Read_int (fld_media_count))
|
||||
.Val_int (fld_lnki_count , rdr.Read_int (fld_lnki_count))
|
||||
.Val_int (fld_lnke_count , rdr.Read_int (fld_lnke_count))
|
||||
.Val_int (fld_hdr_count , rdr.Read_int (fld_hdr_count))
|
||||
.Val_int (fld_math_count , rdr.Read_int (fld_math_count))
|
||||
.Val_int (fld_imap_count , rdr.Read_int (fld_imap_count))
|
||||
.Val_int (fld_hiero_count , rdr.Read_int (fld_hiero_count))
|
||||
.Val_int (fld_gallery_count , rdr.Read_int (fld_gallery_count))
|
||||
.Val_int (fld_gallery_packed_count , rdr.Read_int (fld_gallery_packed_count))
|
||||
.Exec_insert();
|
||||
}
|
||||
public void Insert(Xoae_page wpg, Xoh_page hpg, int wkr_uid, long page_time, long fulltext_time) {
|
||||
Xop_log_stat stat = wpg.Stat_itm();
|
||||
stmt_insert.Clear()
|
||||
.Val_int(fld_page_id , hpg.Page_id())
|
||||
.Val_int(fld_wkr_uid , wkr_uid)
|
||||
.Val_int(fld_wtxt_len , Len_or_0(wpg.Root().Root_src()))
|
||||
.Val_int(fld_html_len , Len_or_0(hpg.Db().Html().Html_bry()))
|
||||
.Val_int(fld_zip_len , hpg.Db().Html().Zip_len())
|
||||
.Val_long(fld_page_time , page_time)
|
||||
.Val_long(fld_tidy_time , stat.Tidy_time)
|
||||
.Val_long(fld_fulltext_time , fulltext_time)
|
||||
.Val_long(fld_scrib_time , stat.Scrib().Time())
|
||||
.Val_int (fld_scrib_count , stat.Scrib().Count())
|
||||
.Val_int (fld_scrib_depth , stat.Scrib().Depth_max())
|
||||
.Val_int (fld_image_count , stat.Image_count)
|
||||
.Val_int (fld_audio_count , stat.Audio_count)
|
||||
.Val_int (fld_video_count , stat.Video_count)
|
||||
.Val_int (fld_media_count , stat.Media_count)
|
||||
.Val_int (fld_lnki_count , stat.Lnki_count)
|
||||
.Val_int (fld_lnke_count , stat.Lnke_count)
|
||||
.Val_int (fld_hdr_count , stat.Hdr_count)
|
||||
.Val_int (fld_math_count , stat.Math_count)
|
||||
.Val_int (fld_imap_count , stat.Imap_count)
|
||||
.Val_int (fld_hiero_count , stat.Hiero_count)
|
||||
.Val_int (fld_gallery_count , stat.Gallery_count)
|
||||
.Val_int (fld_gallery_packed_count , stat.Gallery_packed_count)
|
||||
.Exec_insert();
|
||||
}
|
||||
public void Stmt_rls() {
|
||||
stmt_insert = Db_stmt_.Rls(stmt_insert);
|
||||
}
|
||||
private static int Len_or_0(byte[] bry) {return bry == null ? 0 : bry.length;}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.addons.bldrs.mass_parses.makes; import gplx.*; import gplx.xowa.*; import gplx.xowa.addons.*; import gplx.xowa.addons.bldrs.*; import gplx.xowa.addons.bldrs.mass_parses.*;
|
||||
import gplx.core.brys.*;
|
||||
import gplx.dbs.*; import gplx.xowa.htmls.core.dbs.*; import gplx.xowa.addons.bldrs.mass_parses.dbs.*;
|
||||
class Xomp_make_stat {
|
||||
public void Exec(Xowe_wiki wiki, Xomp_make_cmd_cfg cfg) {
|
||||
// init mgr_db and mgr_tbl
|
||||
Xomp_mgr_db mgr_db = Xomp_mgr_db.New__load(wiki);
|
||||
Db_conn mgr_conn = mgr_db.Conn();
|
||||
Xomp_stat_tbl mgr_tbl = new Xomp_stat_tbl(mgr_conn);
|
||||
mgr_conn.Txn_bgn("xomp_stats");
|
||||
mgr_tbl.Stmt_new();
|
||||
|
||||
// loop wkrs
|
||||
String sql = String_.Format("SELECT * FROM xomp_stats;");
|
||||
int wkrs_len = mgr_db.Tbl__wkr().Select_count();
|
||||
for (int i = 0; i < wkrs_len; ++i) {
|
||||
int count = 0;
|
||||
Xomp_wkr_db wkr_db = Xomp_wkr_db.New(mgr_db.Dir(), i);
|
||||
Db_rdr rdr = wkr_db.Conn().Stmt_sql(sql).Exec_select__rls_auto(); // ANSI.Y
|
||||
try {
|
||||
while (rdr.Move_next()) {
|
||||
mgr_tbl.Insert_by_copy(rdr);
|
||||
if (++count % 10000 == 0) {
|
||||
Gfo_usr_dlg_.Instance.Prog_many("", "", "xomp.stat.insert: db=~{0} count=~{1}", Int_.To_str_pad_bgn_space(i, 3), Int_.To_str_pad_bgn_space(count, 8));
|
||||
mgr_conn.Txn_sav();
|
||||
}
|
||||
}
|
||||
} finally {rdr.Rls();}
|
||||
}
|
||||
|
||||
// cleanup
|
||||
mgr_tbl.Stmt_rls();
|
||||
mgr_conn.Txn_end();
|
||||
mgr_conn.Rls_conn();
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.htmls.core.hzips; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*;
|
||||
import gplx.xowa.htmls.core.wkrs.lnkes.*;
|
||||
public class Xoh_stat_itm {
|
||||
public void Clear() {
|
||||
a_rhs = lnki_text_n = lnki_text_y = lnke__free = lnke__auto = lnke__text = 0;
|
||||
hdr_1 = hdr_2 = hdr_3 = hdr_4 = hdr_5 = hdr_6 = timeline = gallery = 0;
|
||||
img_full = 0;
|
||||
space = 0;
|
||||
Bry_.Clear(escape_bry);
|
||||
}
|
||||
public int A_rhs() {return a_rhs;} public void A_rhs_add() {++a_rhs;} private int a_rhs;
|
||||
public int Lnki_text_n() {return lnki_text_n;} public void Lnki_text_n_add() {++lnki_text_n;} private int lnki_text_n;
|
||||
public int Lnki_text_y() {return lnki_text_y;} public void Lnki_text_y_add() {++lnki_text_y;} private int lnki_text_y;
|
||||
public int Lnke__free() {return lnke__free;} public void Lnke__free__add() {++lnke__free;} private int lnke__free;
|
||||
public int Lnke__auto() {return lnke__auto;} public void Lnke__auto__add() {++lnke__auto;} private int lnke__auto;
|
||||
public int Lnke__text() {return lnke__text;} public void Lnke__text__add() {++lnke__text;} private int lnke__text;
|
||||
public int Img_full() {return img_full;} public void Img_full_add() {++img_full;} private int img_full;
|
||||
public int Timeline() {return timeline;} public void Timeline_add() {++timeline;} private int timeline;
|
||||
public int Gallery() {return gallery;} public void Gallery_add() {++gallery;} private int gallery;
|
||||
public int Hdr_1() {return hdr_1;} private int hdr_1;
|
||||
public int Hdr_2() {return hdr_2;} private int hdr_2;
|
||||
public int Hdr_3() {return hdr_3;} private int hdr_3;
|
||||
public int Hdr_4() {return hdr_4;} private int hdr_4;
|
||||
public int Hdr_5() {return hdr_5;} private int hdr_5;
|
||||
public int Hdr_6() {return hdr_6;} private int hdr_6;
|
||||
public int Space() {return space;} public void Space_add(int v) {space += v;} private int space;
|
||||
public byte[] Escape_bry() {return escape_bry;} public void Escape_add(byte v) {escape_bry[v] += 1;} private final byte[] escape_bry = new byte[256];
|
||||
public void Hdr_add(int hdr_num) {
|
||||
switch (hdr_num) {
|
||||
case 1: ++hdr_1; break;
|
||||
case 2: ++hdr_2; break;
|
||||
case 3: ++hdr_3; break;
|
||||
case 4: ++hdr_4; break;
|
||||
case 5: ++hdr_5; break;
|
||||
case 6: ++hdr_6; break;
|
||||
default: throw Err_.new_unhandled(hdr_num);
|
||||
}
|
||||
}
|
||||
public void Lnki_add(int orig_len, int hzip_len, int flag) {
|
||||
}
|
||||
public void Lnke_add(byte lnke_type) {
|
||||
switch (lnke_type) {
|
||||
case Xoh_lnke_dict_.Type__free: ++lnke__free; break;
|
||||
case Xoh_lnke_dict_.Type__auto: ++lnke__auto; break;
|
||||
case Xoh_lnke_dict_.Type__text: ++lnke__text; break;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.htmls.core.hzips; import gplx.*; import gplx.xowa.*; import gplx.xowa.htmls.*; import gplx.xowa.htmls.core.*;
|
||||
import gplx.dbs.*; import gplx.dbs.engines.sqlite.*; import gplx.xowa.htmls.core.hzips.*;
|
||||
import gplx.xowa.wikis.pages.*;
|
||||
public class Xoh_stat_tbl implements Rls_able {
|
||||
private static final String tbl_name = "hdump_stats"; private static final Dbmeta_fld_list flds = new Dbmeta_fld_list();
|
||||
private static final String
|
||||
fld_page_id = flds.Add_int_pkey("page_id"), fld_wtxt_len = flds.Add_int("wtxt_len"), fld_row_orig_len = flds.Add_int("row_orig_len"), fld_row_zip_len = flds.Add_int("row_zip_len")
|
||||
, fld_body_len = flds.Add_int("body_len"), fld_display_ttl_len = flds.Add_int("display_ttl_len"), fld_content_sub_len = flds.Add_int("content_sub_len"), fld_sidebar_div_len = flds.Add_int("sidebar_div_len")
|
||||
, fld_js_math = flds.Add_int("js_math"), fld_js_imap = flds.Add_int("js_imap"), fld_js_packed = flds.Add_int("js_packed"), fld_js_hiero = flds.Add_int("js_hiero")
|
||||
, fld_a_rhs = flds.Add_int("a_rhs"), fld_lnki_text_n = flds.Add_int("lnki_text_n"), fld_lnki_text_y = flds.Add_int("lnki_text_y")
|
||||
, fld_lnke_free = flds.Add_int("lnke_free"), fld_lnke_auto = flds.Add_int("lnke_auto"), fld_lnke_text = flds.Add_int("lnke_text")
|
||||
, fld_hdr_1 = flds.Add_int("hdr_1"), fld_hdr_2 = flds.Add_int("hdr_2"), fld_hdr_3 = flds.Add_int("hdr_3"), fld_hdr_4 = flds.Add_int("hdr_4"), fld_hdr_5 = flds.Add_int("hdr_5"), fld_hdr_6 = flds.Add_int("hdr_6")
|
||||
, fld_img_full = flds.Add_int("img_full")
|
||||
;
|
||||
private final Db_conn conn; private Db_stmt stmt_insert;
|
||||
public Xoh_stat_tbl(Db_conn conn) {
|
||||
this.conn = conn;
|
||||
this.Create_tbl();
|
||||
conn.Stmt_delete(tbl_name).Exec_delete(); // always zap table
|
||||
conn.Rls_reg(this);
|
||||
}
|
||||
public void Create_tbl() {conn.Meta_tbl_create(Dbmeta_tbl_itm.New(tbl_name, flds, Dbmeta_idx_itm.new_unique_by_tbl(tbl_name, "pkey", fld_page_id)));}
|
||||
public void Rls() {
|
||||
stmt_insert = Db_stmt_.Rls(stmt_insert);
|
||||
}
|
||||
public void Insert(Xoh_page hpg, Xoh_stat_itm hzip, int wtxt_len, int row_orig_len, int row_zip_len) {
|
||||
Xopg_module_mgr js_mgr = hpg.Head_mgr();
|
||||
if (stmt_insert == null) stmt_insert = conn.Stmt_insert(tbl_name, flds);
|
||||
stmt_insert.Clear()
|
||||
.Val_int(fld_page_id , hpg.Page_id())
|
||||
.Val_int(fld_wtxt_len , wtxt_len)
|
||||
.Val_int(fld_row_orig_len , row_orig_len)
|
||||
.Val_int(fld_row_zip_len , row_zip_len)
|
||||
.Val_int(fld_body_len , Len_or_0(hpg.Db().Html().Html_bry()))
|
||||
.Val_int(fld_display_ttl_len , Len_or_0(hpg.Display_ttl()))
|
||||
.Val_int(fld_content_sub_len , Len_or_0(hpg.Content_sub()))
|
||||
.Val_int(fld_sidebar_div_len , Len_or_0(hpg.Sidebar_div()))
|
||||
.Val_bool_as_byte(fld_js_math , js_mgr.Math_exists())
|
||||
.Val_bool_as_byte(fld_js_imap , js_mgr.Imap_exists())
|
||||
.Val_bool_as_byte(fld_js_packed , js_mgr.Gallery_packed_exists())
|
||||
.Val_bool_as_byte(fld_js_hiero , js_mgr.Hiero_exists())
|
||||
.Val_int(fld_a_rhs , hzip.A_rhs())
|
||||
.Val_int(fld_lnki_text_n , hzip.Lnki_text_n())
|
||||
.Val_int(fld_lnki_text_y , hzip.Lnki_text_y())
|
||||
.Val_int(fld_lnke_free , hzip.Lnke__free())
|
||||
.Val_int(fld_lnke_auto , hzip.Lnke__auto())
|
||||
.Val_int(fld_lnke_text , hzip.Lnke__text())
|
||||
.Val_int(fld_hdr_1 , hzip.Hdr_1())
|
||||
.Val_int(fld_hdr_2 , hzip.Hdr_2())
|
||||
.Val_int(fld_hdr_3 , hzip.Hdr_3())
|
||||
.Val_int(fld_hdr_4 , hzip.Hdr_4())
|
||||
.Val_int(fld_hdr_5 , hzip.Hdr_5())
|
||||
.Val_int(fld_hdr_6 , hzip.Hdr_6())
|
||||
.Val_int(fld_img_full , hzip.Img_full())
|
||||
.Exec_insert();
|
||||
}
|
||||
private int Len_or_0(byte[] bry) {return bry == null ? 0 : bry.length;}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.parsers.logs.stats; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*; import gplx.xowa.parsers.logs.*;
|
||||
public class Xop_log_stat {
|
||||
public boolean Enabled() {return enabled;} private boolean enabled;
|
||||
public int Wkr_uid() {return wkr_uid;} private int wkr_uid = -1;
|
||||
public Xop_log_time_count Scrib() {return scrib;} private final Xop_log_time_count scrib = new Xop_log_time_count();
|
||||
public long Tidy_time;
|
||||
public int Image_count;
|
||||
public int Audio_count;
|
||||
public int Video_count;
|
||||
public int Media_count;
|
||||
public int Hdr_count;
|
||||
public int Lnki_count;
|
||||
public int Lnke_count;
|
||||
public int Math_count;
|
||||
public int Imap_count;
|
||||
public int Hiero_count;
|
||||
public int Gallery_count;
|
||||
public int Gallery_packed_count;
|
||||
public void Init(int v) {
|
||||
enabled = true;
|
||||
wkr_uid = v;
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
XOWA: the XOWA Offline Wiki Application
|
||||
Copyright (C) 2012-2017 gnosygnu@gmail.com
|
||||
|
||||
XOWA is licensed under the terms of the General Public License (GPL) Version 3,
|
||||
or alternatively under the terms of the Apache License Version 2.0.
|
||||
|
||||
You may use XOWA according to either of these licenses as is most appropriate
|
||||
for your project on a case-by-case basis.
|
||||
|
||||
The terms of each license can be found in the source code repository:
|
||||
|
||||
GPLv3 License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-GPLv3.txt
|
||||
Apache License: https://github.com/gnosygnu/xowa/blob/master/LICENSE-APACHE2.txt
|
||||
*/
|
||||
package gplx.xowa.parsers.logs.stats; import gplx.*; import gplx.xowa.*; import gplx.xowa.parsers.*; import gplx.xowa.parsers.logs.*;
|
||||
public class Xop_log_time_count {
|
||||
private int count;
|
||||
private long time;
|
||||
private int depth;
|
||||
private int depth_max;
|
||||
private long time_bgn;
|
||||
public int Count() {return count;}
|
||||
public long Time() {return time;}
|
||||
public int Depth_max() {return depth_max;}
|
||||
public void Bgn() {
|
||||
if (time_bgn == 0) {
|
||||
time_bgn = gplx.core.envs.System_.Ticks();
|
||||
}
|
||||
depth++;
|
||||
if (depth_max < depth)
|
||||
depth_max = depth;
|
||||
}
|
||||
public void End() {
|
||||
depth--;
|
||||
if (depth == 0) {
|
||||
long time_end = gplx.core.envs.System_.Ticks();
|
||||
this.time += time_end - time_bgn;
|
||||
this.time_bgn = 0;
|
||||
}
|
||||
this.count++;
|
||||
}
|
||||
public void Clear() {
|
||||
count = 0;
|
||||
time = 0;
|
||||
time_bgn = 0;
|
||||
depth = 0;
|
||||
depth_max = 0;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue