libsize.py
Go to the documentation of this file.
1 import os
2 import sys
3 
4 # Internal build script for generating debugging test .so size.
5 # Usage:
6 # python libsize.py file.so save.txt -- displays the size of file.so and, if save.txt exists, compares it to the
7 # size in it, then overwrites save.txt with the new size for future runs.
8 
9 if len(sys.argv) != 3:
10  sys.exit("Invalid arguments: usage: python libsize.py file.so save.txt")
11 
12 lib = sys.argv[1]
13 save = sys.argv[2]
14 
15 if not os.path.exists(lib):
16  sys.exit(f"Error: requested file ({lib}) does not exist")
17 
18 libsize = os.path.getsize(lib)
19 
20 print("------", os.path.basename(lib), "file size:", libsize, end="")
21 
22 if os.path.exists(save):
23  with open(save) as sf:
24  oldsize = int(sf.readline())
25 
26  if oldsize > 0:
27  change = libsize - oldsize
28  if change == 0:
29  print(" (no change)")
30  else:
31  print(f" (change of {change:+} bytes = {change / oldsize:+.2%})")
32 else:
33  print()
34 
35 with open(save, "w") as sf:
36  sf.write(str(libsize))
gtsam.examples.DogLegOptimizerExample.int
int
Definition: DogLegOptimizerExample.py:111
Eigen::internal::print
EIGEN_STRONG_INLINE Packet4f print(const Packet4f &a)
Definition: NEON/PacketMath.h:3115
str
Definition: pytypes.h:1524
len
size_t len(handle h)
Get the length of a Python object.
Definition: pytypes.h:2399


gtsam
Author(s):
autogenerated on Thu Jun 13 2024 03:03:00