Debian Codegraph @

src/json_format.h

raw symbols SCIP
1 /* Module for outputting json formatted profiling information
2 Copyright (C) 2021 Google LLC
3
4 This file is part of GNU Make.
5
6 GNU Make is free software; you can redistribute it and/or modify it under the
7 terms of the GNU General Public License as published by the Free Software
8 Foundation; either version 3 of the License, or (at your option) any later
9 version.
10
11 GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License along with
16 this program. If not, see <http://www.gnu.org/licenses/>. */
17
18 /** \file json_format.h
19 *
20 * \brief Header for routines for outputting profiling information in json
21 *
22 * JSON output dumps target information in an easily parsable format
23 * for post-processing by external tools. The file is named build.XYZ.json
24 * where XYZ is the pid of the remake process and which is also captured in the
25 * file.
26 *
27 * The output format uses the following scheme:
28 *
29 * \code{.json}
30 * {
31 * "version":"1.0.0",
32 * "pid":1234,
33 * "parent":{
34 * "pid":1230,
35 * "target":"target-name"
36 * },
37 * "jobs": 8,
38 * "server": 1,
39 * "creator":"remake"
40 * "argv":[
41 * "arg0",
42 * "arg1",
43 * "arg2"
44 * ],
45 * "directory":"path/to/working/dir",
46 * "status":"Normal program termination",
47 * "start":1235.6789,
48 * "end":1240.0123,
49 * "resolution":1000,
50 * "entry":[
51 * "all",
52 * "other"
53 * ],
54 * "targets":[
55 * {
56 * "name":"all",
57 * "file":"path/to/file/with/target",
58 * "line":100,
59 * "start":123.123,
60 * "deps":null,
61 * "recipe":124.0,
62 * "end":124.124,
63 * "depends":[
64 * "dependent",
65 * "target0",
66 * "target1",
67 * "target2"
68 * ]
69 * }
70 * ]
71 * }
72 * \endcode
73 */
74
75 #ifndef _REMAKE_JSON_FORMAT_H
76 #define _REMAKE_JSON_FORMAT_H
77
78 #include "profile.h"
79
80 /**
81 * \brief Initializes json output for profiling
82 *
83 * \param[in] ctx Context of the profiler
84 * \param[in] creator String identifying creator of the file
85 * \param[in] argv Array of strings that represent the command used to start remake
86 */
87 extern bool json_init(profile_context_t *ctx, const char *creator, const char *const *argv);
88
89 /**
90 * \brief Dumps profiling data and closes the json output file
91 *
92 * \param[in] ctx Context of the profiler
93 * \param[in] program_status Textual representation of the exit reason
94 */
95 extern void json_close(profile_context_t *ctx, const char *program_status);
96
97 #endif // _REMAKE_JSON_FORMAT_H