Home | History | Annotate | Download | only in quipper
      1 // Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROMIUMOS_WIDE_PROFILING_PERF_PROTOBUF_IO_H_
      6 #define CHROMIUMOS_WIDE_PROFILING_PERF_PROTOBUF_IO_H_
      7 
      8 #include "compat/proto.h"
      9 #include "compat/string.h"
     10 #include "perf_parser.h"
     11 #include "perf_reader.h"
     12 
     13 namespace quipper {
     14 
     15 // Convert a raw perf data file to a PerfDataProto protobuf. Uses PerfParser to
     16 // to process the data before writing it to the protobuf.
     17 bool SerializeFromFile(const string& filename, PerfDataProto* proto);
     18 
     19 // Same as SerializeFromFile(), but passes the given PerfParserOptions to
     20 // PerfParser.
     21 bool SerializeFromFileWithOptions(const string& filename,
     22                                   const PerfParserOptions& options,
     23                                   PerfDataProto* proto);
     24 
     25 // Convert a PerfDataProto to raw perf data, storing it in a file.
     26 bool DeserializeToFile(const PerfDataProto& proto, const string& filename);
     27 
     28 // Writes PerfDataProto object to a file as serialized protobuf data.
     29 bool WriteProtobufToFile(const quipper::PerfDataProto& perf_data_proto,
     30                          const string& filename);
     31 
     32 // Read from a file containing serialized PerfDataProto data into a
     33 // PerfDataProto object.
     34 bool ReadProtobufFromFile(quipper::PerfDataProto* perf_data_proto,
     35                           const string& filename);
     36 
     37 }  // namespace quipper
     38 
     39 #endif  // CHROMIUMOS_WIDE_PROFILING_PERF_PROTOBUF_IO_H_
     40