Loading bloaty/bloaty.go +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ import ( ) const bloatyDescriptorExt = ".bloaty.csv" const protoFilename = "binary_sizes.pb" const protoFilename = "binary_sizes.pb.gz" var ( fileSizeMeasurerKey blueprint.ProviderKey Loading bloaty/bloaty_merger.py +5 −3 Original line number Diff line number Diff line Loading @@ -16,12 +16,13 @@ Merges a list of .csv files from Bloaty into a protobuf. It takes the list as a first argument and the output as second. For instance: $ bloaty_merger binary_sizes.lst binary_sizes.pb $ bloaty_merger binary_sizes.lst binary_sizes.pb.gz """ import argparse import csv import gzip import ninja_rsp Loading Loading @@ -57,7 +58,8 @@ def create_file_size_metrics(input_list, output_proto): Args: input_list: The path to the file which contains the list of CSV files. Each filepath is separated by a space. output_proto: The path for the output protobuf. output_proto: The path for the output protobuf. It will be compressed using gzip. """ metrics = file_sections_pb2.FileSizeMetrics() reader = ninja_rsp.NinjaRspFileReader(input_list) Loading @@ -65,7 +67,7 @@ def create_file_size_metrics(input_list, output_proto): file_proto = parse_csv(csv_path) if file_proto: metrics.files.append(file_proto) with open(output_proto, "wb") as output: with gzip.open(output_proto, "wb") as output: output.write(metrics.SerializeToString()) def main(): Loading bloaty/bloaty_merger_test.py +3 −2 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import gzip import unittest from pyfakefs import fake_filesystem_unittest Loading Loading @@ -53,10 +54,10 @@ class BloatyMergerTestCase(fake_filesystem_unittest.TestCase): self.fs.create_file("file1.bloaty.csv", contents=file1_content) self.fs.create_file("file2.bloaty.csv", contents=file2_content) bloaty_merger.create_file_size_metrics("files.lst", "output.pb") bloaty_merger.create_file_size_metrics("files.lst", "output.pb.gz") metrics = file_sections_pb2.FileSizeMetrics() with open("output.pb", "rb") as output: with gzip.open("output.pb.gz", "rb") as output: metrics.ParseFromString(output.read()) Loading Loading
bloaty/bloaty.go +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ import ( ) const bloatyDescriptorExt = ".bloaty.csv" const protoFilename = "binary_sizes.pb" const protoFilename = "binary_sizes.pb.gz" var ( fileSizeMeasurerKey blueprint.ProviderKey Loading
bloaty/bloaty_merger.py +5 −3 Original line number Diff line number Diff line Loading @@ -16,12 +16,13 @@ Merges a list of .csv files from Bloaty into a protobuf. It takes the list as a first argument and the output as second. For instance: $ bloaty_merger binary_sizes.lst binary_sizes.pb $ bloaty_merger binary_sizes.lst binary_sizes.pb.gz """ import argparse import csv import gzip import ninja_rsp Loading Loading @@ -57,7 +58,8 @@ def create_file_size_metrics(input_list, output_proto): Args: input_list: The path to the file which contains the list of CSV files. Each filepath is separated by a space. output_proto: The path for the output protobuf. output_proto: The path for the output protobuf. It will be compressed using gzip. """ metrics = file_sections_pb2.FileSizeMetrics() reader = ninja_rsp.NinjaRspFileReader(input_list) Loading @@ -65,7 +67,7 @@ def create_file_size_metrics(input_list, output_proto): file_proto = parse_csv(csv_path) if file_proto: metrics.files.append(file_proto) with open(output_proto, "wb") as output: with gzip.open(output_proto, "wb") as output: output.write(metrics.SerializeToString()) def main(): Loading
bloaty/bloaty_merger_test.py +3 −2 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import gzip import unittest from pyfakefs import fake_filesystem_unittest Loading Loading @@ -53,10 +54,10 @@ class BloatyMergerTestCase(fake_filesystem_unittest.TestCase): self.fs.create_file("file1.bloaty.csv", contents=file1_content) self.fs.create_file("file2.bloaty.csv", contents=file2_content) bloaty_merger.create_file_size_metrics("files.lst", "output.pb") bloaty_merger.create_file_size_metrics("files.lst", "output.pb.gz") metrics = file_sections_pb2.FileSizeMetrics() with open("output.pb", "rb") as output: with gzip.open("output.pb.gz", "rb") as output: metrics.ParseFromString(output.read()) Loading