Lines Matching refs:out

36 	FILE *out;
42 static void output_json_string(FILE *out, const char *s)
44 fputc('"', out);
49 case '"': fputs("\\\"", out); break;
50 case '\\': fputs("\\\\", out); break;
51 case '\b': fputs("\\b", out); break;
52 case '\f': fputs("\\f", out); break;
53 case '\n': fputs("\\n", out); break;
54 case '\r': fputs("\\r", out); break;
55 case '\t': fputs("\\t", out); break;
60 fprintf(out, "\\u%04x", *s);
62 fputc(*s, out);
68 fputc('"', out);
73 static void output_json_delimiters(FILE *out, bool comma, int depth)
78 fputc(',', out);
79 fputc('\n', out);
81 fputc('\t', out);
86 static void output_json_format(FILE *out, bool comma, int depth, const char *format, ...)
90 output_json_delimiters(out, comma, depth);
92 vfprintf(out, format, args);
97 static void output_json_key_string(FILE *out, bool comma, int depth,
100 output_json_delimiters(out, comma, depth);
101 output_json_string(out, key);
102 fputs(": ", out);
103 output_json_string(out, value);
108 static void output_json_key_format(FILE *out, bool comma, int depth,
113 output_json_delimiters(out, comma, depth);
114 output_json_string(out, key);
115 fputs(": ", out);
117 vfprintf(out, format, args);
125 FILE *out = c->out;
127 output_json_format(out, false, 4, "{");
128 output_json_key_format(out, false, 5, "ip", "\"0x%" PRIx64 "\"", ip);
133 fputc(',', out);
134 output_json_key_string(out, false, 5, "symbol", al->sym->name);
140 fputc(',', out);
141 output_json_key_string(out, false, 5, "dso", dso_name);
146 output_json_format(out, false, 4, "}");
156 FILE *out = c->out;
173 fputc(',', out);
174 output_json_format(out, false, 2, "{");
176 output_json_key_format(out, false, 3, "timestamp", "%" PRIi64, sample->time);
177 output_json_key_format(out, true, 3, "pid", "%i", thread__pid(al.thread));
178 output_json_key_format(out, true, 3, "tid", "%i", thread__tid(al.thread));
181 output_json_key_format(out, true, 3, "cpu", "%i", sample->cpu);
183 output_json_key_format(out, true, 3, "cpu", "%i", thread__cpu(al.thread));
185 output_json_key_string(out, true, 3, "comm", thread__comm_str(al.thread));
187 output_json_key_format(out, true, 3, "callchain", "[");
219 fputc(',', out);
229 output_json_format(out, false, 3, "]");
244 output_json_key_string(out, true, 3, fields[i]->name, s.buffer);
252 output_json_format(out, false, 2, "}");
264 FILE *out = c->out;
266 output_json_key_format(out, false, 2, "header-version", "%u", header->version);
274 output_json_key_string(out, true, 2, "captured-on", buf);
279 output_json_key_format(out, true, 2, "data-offset", "%" PRIu64, header->data_offset);
280 output_json_key_format(out, true, 2, "data-size", "%" PRIu64, header->data_size);
281 output_json_key_format(out, true, 2, "feat-offset", "%" PRIu64, header->feat_offset);
283 output_json_key_string(out, true, 2, "hostname", header->env.hostname);
284 output_json_key_string(out, true, 2, "os-release", header->env.os_release);
285 output_json_key_string(out, true, 2, "arch", header->env.arch);
288 output_json_key_string(out, true, 2, "cpu-desc", header->env.cpu_desc);
290 output_json_key_string(out, true, 2, "cpuid", header->env.cpuid);
291 output_json_key_format(out, true, 2, "nrcpus-online", "%u", header->env.nr_cpus_online);
292 output_json_key_format(out, true, 2, "nrcpus-avail", "%u", header->env.nr_cpus_avail);
295 output_json_key_format(out, true, 2, "clockid",
297 output_json_key_format(out, true, 2, "clock-time",
299 output_json_key_format(out, true, 2, "real-time",
303 output_json_key_string(out, true, 2, "perf-version", header->env.version);
305 output_json_key_format(out, true, 2, "cmdline", "[");
307 output_json_delimiters(out, i != 0, 3);
308 output_json_string(c->out, header->env.cmdline_argv[i]);
310 output_json_format(out, false, 2, "]");
367 c.out = fdopen(fd, "w");
368 if (!c.out) {
387 fputc('{', c.out);
392 output_json_format(c.out, false, 1, "\"linux-perf-json-version\": 1");
395 output_json_format(c.out, true, 1, "\"headers\": {");
397 output_json_format(c.out, false, 1, "}");
400 output_json_format(c.out, true, 1, "\"samples\": [");
402 output_json_format(c.out, false, 1, "]");
403 output_json_format(c.out, false, 0, "}");
404 fputc('\n', c.out);
412 (ftell(c.out)) / 1024.0 / 1024.0, c.events_count);
418 fclose(c.out);