2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-02-08 06:08:21 +00:00

profiling on only begin/end/date

This commit is contained in:
2026-01-28 18:10:21 +00:00
parent 5a1c0a2bd6
commit b780006dfb
5 changed files with 17312 additions and 45309 deletions

View File

@@ -2016,67 +2016,46 @@ class LoadingSurvex:
# -----------------------------
elif self.rx_title.match(cmd):
t3 = time.perf_counter()
quotedtitle = self.rx_quotedtitle.match(args)
timing_data.append(f"starstatement:*title {time.perf_counter() - t3:.6f}\n")
if quotedtitle:
survexblock.title = quotedtitle.groups()[0]
else:
survexblock.title = args
elif self.rx_ref.match(cmd):
t4 = time.perf_counter()
self.LoadSurvexRef(survexblock, args)
timing_data.append(f"starstatement:*ref {time.perf_counter() - t4:.6f}\n")
elif self.rx_flags.match(cmd):
t5 = time.perf_counter()
oldflags = self.flagsstar
self.LoadSurvexFlags(args)
if debugprint:
timing_data.append(f"starstatement:*flags {time.perf_counter() - t5:.6f}\n")
if oldflags["skiplegs"] != self.flagsstar["skiplegs"]:
print(f" # CHANGE 'any' flag now:'{self.flagsstar['skiplegs']}' was:{oldflags['skiplegs']} ")
elif self.rx_data.match(cmd):
t6 = time.perf_counter()
if self.LoadSurvexDataNormal(survexblock, args):
timing_data.append(f"starstatement:*data {time.perf_counter() - t6:.6f}\n")
# print(f"just normal data {cmd=} {args=} {survexblock=}", file=sys.stderr)
# Only keep timing for *data if you want, but per request, remove it
pass
else:
# returns false i.e. something we do not need to worry about
return
elif self.rx_alias.match(cmd):
t7 = time.perf_counter()
self.LoadSurvexAlias(survexblock, args)
timing_data.append(f"starstatement:*alias {time.perf_counter() - t7:.6f}\n")
elif self.rx_entrance.match(cmd):
t8 = time.perf_counter()
self.LoadSurvexEntrance(survexblock, args)
timing_data.append(f"starstatement:*entrance {time.perf_counter() - t8:.6f}\n")
elif self.rx_date.match(cmd):
t9 = time.perf_counter()
self.LoadSurvexDate(survexblock, args)
timing_data.append(f"starstatement:*date {time.perf_counter() - t9:.6f}\n")
elif self.rx_fix.match(cmd):
t10 = time.perf_counter()
self.LoadSurvexFix(survexblock, fullline) # but we want the comment on this line
timing_data.append(f"starstatement:*fix {time.perf_counter() - t10:.6f}\n")
elif self.rx_units.match(cmd):
t11 = time.perf_counter()
self.LoadSurvexUnits(survexblock, args)
timing_data.append(f"starstatement:*units {time.perf_counter() - t11:.6f}\n")
elif self.rx_team.match(cmd):
t12 = time.perf_counter()
self.LoadSurvexTeam(survexblock, args)
timing_data.append(f"starstatement:*team {time.perf_counter() - t12:.6f}\n")
elif self.rx_set.match(cmd): # and self.rx_names.match(cmd):
t13 = time.perf_counter()
self.LoadSurvexSet(survexblock, args)
timing_data.append(f"starstatement:*set {time.perf_counter() - t13:.6f}\n")
elif self.rx_include.match(cmd):
t14 = time.perf_counter()
message = f" ! -ERROR *include command not expected here {path}. Re-run a full Survex import."
timing_data.append(f"starstatement:*include {time.perf_counter() - t14:.6f}\n")
print(message)
print(message, file=sys.stderr)
stash_data_issue(
@@ -2084,11 +2063,9 @@ class LoadingSurvex:
message=message,
)
else:
t15 = time.perf_counter()
if cmd not in ["equate", "export", "instrument", "calibrate", "cs", "require", "declination", "infer", "case", "sd"]:
print(f"FALLTHROUGH *{cmd=} {survexblock=} {survexblock.parent=}")
self.LoadSurvexFallThrough(survexblock, args, cmd)
timing_data.append(f"starstatement:*fallthrough {time.perf_counter() - t15:.6f}\n")
# At the end of the import, write all timing data to file
def write_starstatement_timing():