op_header.h revision cc2ee177dbb3befca43e36cfc56778b006c3d050
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 */
28void op_check_header(opd_header const & h1, opd_header const & h2,
29                     std::string const & filename);
30
31/**
32 * check mtime of samples file header against file
33 * all error are fatal
34 */
35void check_mtime(std::string const & file, opd_header const & header);
36
37/**
38 * @param sample_filename  the sample to open
39 *
40 * Return the header of this sample file. Only the magic number is checked
41 * the version number is not checked. All error are fatal
42 */
43opd_header const read_header(std::string const & sample_filename);
44
45/**
46 * output a readable form of header, this don't include the cpu type
47 * and speed
48 */
49std::string const describe_header(opd_header const & header);
50
51/// output a readable form of cpu type and speed
52std::string const describe_cpu(opd_header const & header);
53
54#endif // OP_HEADER_H
55