summaryrefslogtreecommitdiff
path: root/scripts/metrics/viewerstats.py
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-03-01 13:21:16 +0200
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-03-01 13:41:42 +0200
commit97a103255e433629f13e2156aa307ca329cdcfc6 (patch)
treebf5de1cef5930647c4ab87a0cff7f88f0007832d /scripts/metrics/viewerstats.py
parent92c302d6fba687f0921544b278e22b698d058646 (diff)
parent6ca09a94554ec01f5c94ec60fffd01d7e33f3546 (diff)
Merge branch 'master' (DRTVWR-557) into DRTVWR-546
# Conflicts: # autobuild.xml # doc/contributions.txt # indra/cmake/GLOD.cmake # indra/llcommon/tests/llprocess_test.cpp # indra/newview/VIEWER_VERSION.txt # indra/newview/lldrawpoolavatar.cpp # indra/newview/llfloatermodelpreview.cpp # indra/newview/llmodelpreview.cpp # indra/newview/llviewertexturelist.cpp # indra/newview/llvovolume.cpp # indra/newview/viewer_manifest.py
Diffstat (limited to 'scripts/metrics/viewerstats.py')
-rwxr-xr-xscripts/metrics/viewerstats.py54
1 files changed, 27 insertions, 27 deletions
diff --git a/scripts/metrics/viewerstats.py b/scripts/metrics/viewerstats.py
index f7be3d967e..7e19539e15 100755
--- a/scripts/metrics/viewerstats.py
+++ b/scripts/metrics/viewerstats.py
@@ -54,11 +54,11 @@ def show_stats_by_key(recs,indices,settings_sd = None):
v = tuple(v)
per_key_cnt[k][v] += 1
except Exception as e:
- print "err", e
- print "d", d, "k", k, "v", v
+ print("err", e)
+ print("d", d, "k", k, "v", v)
raise
mc = cnt.most_common()
- print "========================="
+ print("=========================")
keyprefix = ""
if len(indices)>0:
keyprefix = ".".join(indices) + "."
@@ -67,32 +67,32 @@ def show_stats_by_key(recs,indices,settings_sd = None):
bigc = m[1]
unset_cnt = len(recs) - bigc
kmc = per_key_cnt[k].most_common(5)
- print i, keyprefix+str(k), bigc
+ print(i, keyprefix+str(k), bigc)
if settings_sd is not None and k in settings_sd and "Value" in settings_sd[k]:
- print " ", "default",settings_sd[k]["Value"],"count",unset_cnt
+ print(" ", "default",settings_sd[k]["Value"],"count",unset_cnt)
for v in kmc:
- print " ", "value",v[0],"count",v[1]
+ print(" ", "value",v[0],"count",v[1])
if settings_sd is not None:
- print "Total keys in settings", len(settings_sd.keys())
+ print("Total keys in settings", len(settings_sd.keys()))
unused_keys = list(set(settings_sd.keys()) - set(cnt.keys()))
unused_keys_non_str = [k for k in unused_keys if settings_sd[k]["Type"] != "String"]
unused_keys_str = [k for k in unused_keys if settings_sd[k]["Type"] == "String"]
# Things that no one in the sample has set to a non-default value. Possible candidates for removal.
- print "\nUnused_keys_non_str", len(unused_keys_non_str)
- print "======================"
- print "\n".join(sorted(unused_keys_non_str))
+ print("\nUnused_keys_non_str", len(unused_keys_non_str))
+ print( "======================")
+ print("\n".join(sorted(unused_keys_non_str)))
# Strings are not currently logged, so we have no info on usage.
- print "\nString keys (usage unknown)", len(unused_keys_str)
- print "======================"
- print "\n".join(sorted(unused_keys_str))
+ print("\nString keys (usage unknown)", len(unused_keys_str))
+ print( "======================")
+ print("\n".join(sorted(unused_keys_str)))
# Things that someone has set but that aren't recognized settings.
unrec_keys = list(set(cnt.keys()) - set(settings_sd.keys()))
- print "\nUnrecognized keys", len(unrec_keys)
- print "======================"
- print "\n".join(sorted(unrec_keys))
+ print("\nUnrecognized keys", len(unrec_keys))
+ print( "======================")
+ print("\n".join(sorted(unrec_keys)))
result = (settings_sd.keys(), unused_keys_str, unused_keys_non_str, unrec_keys)
return result
@@ -138,7 +138,7 @@ def get_used_strings(root_dir):
for dir_name, sub_dir_list, file_list in os.walk(root_dir):
for fname in file_list:
if fname in ["settings.xml", "settings.xml.edit", "settings_per_account.xml"]:
- print "skip", fname
+ print("skip", fname)
continue
(base,ext) = os.path.splitext(fname)
#if ext not in [".cpp", ".hpp", ".h", ".xml"]:
@@ -155,8 +155,8 @@ def get_used_strings(root_dir):
for m in ms:
#print "used_str",m
used_str.add(m)
- print "skipped extensions", skipped_ext
- print "got used_str", len(used_str)
+ print("skipped extensions", skipped_ext)
+ print("got used_str", len(used_str))
return used_str
@@ -171,7 +171,7 @@ if __name__ == "__main__":
args = parser.parse_args()
for fname in args.infiles:
- print "process", fname
+ print("process", fname)
df = pd.read_csv(fname,sep='\t')
#print "DF", df.describe()
jstrs = df['RAW_LOG:BODY']
@@ -182,12 +182,12 @@ if __name__ == "__main__":
show_stats_by_key(recs,[])
show_stats_by_key(recs,["agent"])
if args.preferences:
- print "\nSETTINGS.XML"
+ print("\nSETTINGS.XML")
settings_sd = parse_settings_xml("settings.xml")
#for skey,svals in settings_sd.items():
# print skey, "=>", svals
(all_str,_,_,_) = show_stats_by_key(recs,["preferences","settings"],settings_sd)
- print
+ print()
#print "\nSETTINGS_PER_ACCOUNT.XML"
#settings_pa_sd = parse_settings_xml("settings_per_account.xml")
@@ -201,19 +201,19 @@ if __name__ == "__main__":
unref_strings = all_str_set-used_strings_set
# Some settings names are generated by appending to a prefix. Need to look for this case.
prefix_used = set()
- print "checking unref_strings", len(unref_strings)
+ print("checking unref_strings", len(unref_strings))
for u in unref_strings:
for k in range(6,len(u)):
prefix = u[0:k]
if prefix in all_str_set and prefix in used_strings_set:
prefix_used.add(u)
#print "PREFIX_USED",u,prefix
- print "PREFIX_USED", len(prefix_used), ",".join(list(prefix_used))
- print
+ print("PREFIX_USED", len(prefix_used), ",".join(list(prefix_used)))
+ print()
unref_strings = unref_strings - prefix_used
- print "\nUNREF_IN_CODE " + str(len(unref_strings)) + "\n"
- print "\n".join(list(unref_strings))
+ print("\nUNREF_IN_CODE " + str(len(unref_strings)) + "\n")
+ print("\n".join(list(unref_strings)))
settings_str = read_raw_settings_xml("settings.xml")
# Do this via direct string munging to generate minimal changeset
settings_edited = remove_settings(settings_str,unref_strings)