Mike Dodd | 8cfa702 | 2010-11-17 11:12:26 -0800 | [diff] [blame] | 1 | /** |
| 2 | * @file op_header.h |
| 3 | * various free function acting on a sample file header |
| 4 | * |
| 5 | * @remark Copyright 2002 OProfile authors |
| 6 | * @remark Read the file COPYING |
| 7 | * |
| 8 | * @author John Levon |
| 9 | * @author Philippe Elie |
| 10 | */ |
| 11 | |
| 12 | #ifndef OP_HEADER_H |
| 13 | #define OP_HEADER_H |
| 14 | |
| 15 | #include <iosfwd> |
| 16 | #include <string> |
| 17 | |
| 18 | #include "op_sample_file.h" |
| 19 | |
| 20 | /** |
| 21 | * @param h1 sample file header |
| 22 | * @param h2 sample file header |
| 23 | * @param filename sample filename |
| 24 | * |
| 25 | * check that the h1 and h2 are coherent (same size, same mtime etc.) |
| 26 | * all error are fatal |
| 27 | */ |
| 28 | void op_check_header(opd_header const & h1, opd_header const & h2, |
| 29 | std::string const & filename); |
| 30 | |
| 31 | bool is_jit_sample(std::string const & filename); |
| 32 | |
| 33 | /** |
| 34 | * check mtime of samples file header against file |
| 35 | * all error are fatal |
| 36 | */ |
| 37 | void check_mtime(std::string const & file, opd_header const & header); |
| 38 | |
| 39 | /** |
| 40 | * @param sample_filename the sample to open |
| 41 | * |
| 42 | * Return the header of this sample file. Only the magic number is checked |
| 43 | * the version number is not checked. All error are fatal |
| 44 | */ |
| 45 | opd_header const read_header(std::string const & sample_filename); |
| 46 | |
| 47 | /** |
| 48 | * output a readable form of header, this don't include the cpu type |
| 49 | * and speed |
| 50 | */ |
| 51 | std::string const describe_header(opd_header const & header); |
| 52 | |
| 53 | /// output a readable form of cpu type and speed |
| 54 | std::string const describe_cpu(opd_header const & header); |
| 55 | |
| 56 | #endif // OP_HEADER_H |