Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright © 2014 Pekka Paalanen <pq@iki.fi> |
Marius Vlad | 2a1b786 | 2019-09-05 13:12:18 +0300 | [diff] [blame] | 3 | * Copyright © 2014, 2019 Collabora, Ltd. |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 4 | * |
Bryce Harrington | a0bbfea | 2015-06-11 15:35:43 -0700 | [diff] [blame] | 5 | * Permission is hereby granted, free of charge, to any person obtaining |
| 6 | * a copy of this software and associated documentation files (the |
| 7 | * "Software"), to deal in the Software without restriction, including |
| 8 | * without limitation the rights to use, copy, modify, merge, publish, |
| 9 | * distribute, sublicense, and/or sell copies of the Software, and to |
| 10 | * permit persons to whom the Software is furnished to do so, subject to |
| 11 | * the following conditions: |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 12 | * |
Bryce Harrington | a0bbfea | 2015-06-11 15:35:43 -0700 | [diff] [blame] | 13 | * The above copyright notice and this permission notice (including the |
| 14 | * next paragraph) shall be included in all copies or substantial |
| 15 | * portions of the Software. |
| 16 | * |
| 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 21 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 22 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 23 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 24 | * SOFTWARE. |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 25 | */ |
| 26 | |
| 27 | #include "config.h" |
| 28 | |
| 29 | #include <stdio.h> |
| 30 | #include <errno.h> |
| 31 | #include <string.h> |
| 32 | #include <time.h> |
| 33 | #include <assert.h> |
| 34 | |
Pekka Paalanen | 3d5d947 | 2019-03-28 16:28:47 +0200 | [diff] [blame] | 35 | #include <libweston/libweston.h> |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 36 | #include <libweston/weston-log.h> |
| 37 | #include "timeline.h" |
| 38 | #include "weston-log-internal.h" |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 39 | |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 40 | struct timeline_emit_context { |
| 41 | FILE *cur; |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 42 | struct weston_log_subscription *subscription; |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 43 | }; |
| 44 | |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 45 | /** Create a timeline subscription and hang it off the subscription |
| 46 | * |
| 47 | * Called when the subscription is created. |
| 48 | * |
| 49 | * @ingroup internal-log |
| 50 | */ |
| 51 | void |
| 52 | weston_timeline_create_subscription(struct weston_log_subscription *sub, |
| 53 | void *user_data) |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 54 | { |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 55 | struct weston_timeline_subscription *tl_sub = zalloc(sizeof(*tl_sub)); |
| 56 | if (!tl_sub) |
| 57 | return; |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 58 | |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 59 | wl_list_init(&tl_sub->objects); |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 60 | |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 61 | /* attach this timeline_subscription to it */ |
| 62 | weston_log_subscription_set_data(sub, tl_sub); |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | static void |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 66 | weston_timeline_destroy_subscription_object(struct weston_timeline_subscription_object *sub_obj) |
| 67 | { |
| 68 | /* remove the notify listener */ |
| 69 | wl_list_remove(&sub_obj->destroy_listener.link); |
| 70 | sub_obj->destroy_listener.notify = NULL; |
| 71 | |
| 72 | wl_list_remove(&sub_obj->subscription_link); |
| 73 | free(sub_obj); |
| 74 | } |
| 75 | |
| 76 | /** Destroy the timeline subscription and all timeline subscription objects |
| 77 | * associated with it. |
| 78 | * |
| 79 | * Called when (before) the subscription is destroyed. |
| 80 | * |
| 81 | * @ingroup internal-log |
| 82 | */ |
| 83 | void |
| 84 | weston_timeline_destroy_subscription(struct weston_log_subscription *sub, |
| 85 | void *user_data) |
| 86 | { |
| 87 | struct weston_timeline_subscription *tl_sub = |
| 88 | weston_log_subscription_get_data(sub); |
| 89 | struct weston_timeline_subscription_object *sub_obj, *tmp_sub_obj; |
| 90 | |
| 91 | if (!tl_sub) |
| 92 | return; |
| 93 | |
| 94 | wl_list_for_each_safe(sub_obj, tmp_sub_obj, |
| 95 | &tl_sub->objects, subscription_link) |
| 96 | weston_timeline_destroy_subscription_object(sub_obj); |
| 97 | |
| 98 | free(tl_sub); |
| 99 | } |
| 100 | |
| 101 | static bool |
| 102 | weston_timeline_check_object_refresh(struct weston_timeline_subscription_object *obj) |
| 103 | { |
| 104 | if (obj->force_refresh == true) { |
| 105 | obj->force_refresh = false; |
| 106 | return true; |
| 107 | } |
| 108 | return false; |
| 109 | } |
| 110 | |
| 111 | static struct weston_timeline_subscription_object * |
| 112 | weston_timeline_subscription_search(struct weston_timeline_subscription *tl_sub, |
| 113 | void *object) |
| 114 | { |
| 115 | struct weston_timeline_subscription_object *sub_obj; |
| 116 | |
| 117 | wl_list_for_each(sub_obj, &tl_sub->objects, subscription_link) |
| 118 | if (sub_obj->object == object) |
| 119 | return sub_obj; |
| 120 | |
| 121 | return NULL; |
| 122 | } |
| 123 | |
| 124 | static struct weston_timeline_subscription_object * |
| 125 | weston_timeline_subscription_object_create(void *object, |
| 126 | struct weston_timeline_subscription *tm_sub) |
| 127 | { |
| 128 | struct weston_timeline_subscription_object *sub_obj; |
| 129 | |
| 130 | sub_obj = zalloc(sizeof(*sub_obj)); |
| 131 | sub_obj->id = ++tm_sub->next_id; |
| 132 | sub_obj->object = object; |
| 133 | |
| 134 | /* when the object is created so that it has the chance to display the |
| 135 | * object ID, we set the refresh status; it will only be re-freshed by |
| 136 | * the backend (or part parts) when the underlying objects has suffered |
| 137 | * modifications */ |
| 138 | sub_obj->force_refresh = true; |
| 139 | |
| 140 | wl_list_insert(&tm_sub->objects, &sub_obj->subscription_link); |
| 141 | |
| 142 | return sub_obj; |
| 143 | } |
| 144 | |
| 145 | static void |
| 146 | weston_timeline_destroy_subscription_object_notify(struct wl_listener *listener, void *data) |
| 147 | { |
| 148 | struct weston_timeline_subscription_object *sub_obj; |
| 149 | |
| 150 | sub_obj = wl_container_of(listener, sub_obj, destroy_listener); |
| 151 | weston_timeline_destroy_subscription_object(sub_obj); |
| 152 | } |
| 153 | |
| 154 | static struct weston_timeline_subscription_object * |
| 155 | weston_timeline_subscription_output_ensure(struct weston_timeline_subscription *tl_sub, |
| 156 | struct weston_output *output) |
| 157 | { |
| 158 | struct weston_timeline_subscription_object *sub_obj; |
| 159 | |
| 160 | sub_obj = weston_timeline_subscription_search(tl_sub, output); |
| 161 | if (!sub_obj) { |
| 162 | sub_obj = weston_timeline_subscription_object_create(output, tl_sub); |
| 163 | |
| 164 | sub_obj->destroy_listener.notify = |
| 165 | weston_timeline_destroy_subscription_object_notify; |
| 166 | wl_signal_add(&output->destroy_signal, |
| 167 | &sub_obj->destroy_listener); |
| 168 | } |
| 169 | return sub_obj; |
| 170 | } |
| 171 | |
| 172 | static struct weston_timeline_subscription_object * |
| 173 | weston_timeline_subscription_surface_ensure(struct weston_timeline_subscription *tl_sub, |
| 174 | struct weston_surface *surface) |
| 175 | { |
| 176 | struct weston_timeline_subscription_object *sub_obj; |
| 177 | |
| 178 | sub_obj = weston_timeline_subscription_search(tl_sub, surface); |
| 179 | if (!sub_obj) { |
| 180 | sub_obj = weston_timeline_subscription_object_create(surface, tl_sub); |
| 181 | |
| 182 | sub_obj->destroy_listener.notify = |
| 183 | weston_timeline_destroy_subscription_object_notify; |
| 184 | wl_signal_add(&surface->destroy_signal, |
| 185 | &sub_obj->destroy_listener); |
| 186 | } |
| 187 | |
| 188 | return sub_obj; |
| 189 | } |
| 190 | |
| 191 | static void |
| 192 | fprint_quoted_string(struct weston_log_subscription *sub, const char *str) |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 193 | { |
| 194 | if (!str) { |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 195 | weston_log_subscription_printf(sub, "null"); |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 196 | return; |
| 197 | } |
| 198 | |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 199 | weston_log_subscription_printf(sub, "\"%s\"", str); |
| 200 | } |
| 201 | |
| 202 | static void |
| 203 | emit_weston_output_print_id(struct weston_log_subscription *sub, |
| 204 | struct weston_timeline_subscription_object *sub_obj, |
| 205 | const char *name) |
| 206 | { |
| 207 | if (!weston_timeline_check_object_refresh(sub_obj)) |
| 208 | return; |
| 209 | |
| 210 | weston_log_subscription_printf(sub, "{ \"id\":%u, " |
| 211 | "\"type\":\"weston_output\", \"name\":", sub_obj->id); |
| 212 | fprint_quoted_string(sub, name); |
| 213 | weston_log_subscription_printf(sub, " }\n"); |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 214 | } |
| 215 | |
| 216 | static int |
| 217 | emit_weston_output(struct timeline_emit_context *ctx, void *obj) |
| 218 | { |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 219 | struct weston_log_subscription *sub = ctx->subscription; |
| 220 | struct weston_output *output = obj; |
| 221 | struct weston_timeline_subscription_object *sub_obj; |
| 222 | struct weston_timeline_subscription *tl_sub; |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 223 | |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 224 | tl_sub = weston_log_subscription_get_data(sub); |
| 225 | sub_obj = weston_timeline_subscription_output_ensure(tl_sub, output); |
| 226 | emit_weston_output_print_id(sub, sub_obj, output->name); |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 227 | |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 228 | assert(sub_obj->id != 0); |
| 229 | fprintf(ctx->cur, "\"wo\":%u", sub_obj->id); |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 230 | |
| 231 | return 1; |
| 232 | } |
| 233 | |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 234 | |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 235 | static void |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 236 | check_weston_surface_description(struct weston_log_subscription *sub, |
| 237 | struct weston_surface *s, |
| 238 | struct weston_timeline_subscription *tm_sub, |
| 239 | struct weston_timeline_subscription_object *sub_obj) |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 240 | { |
| 241 | struct weston_surface *mains; |
| 242 | char d[512]; |
| 243 | char mainstr[32]; |
| 244 | |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 245 | if (!weston_timeline_check_object_refresh(sub_obj)) |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 246 | return; |
| 247 | |
| 248 | mains = weston_surface_get_main_surface(s); |
| 249 | if (mains != s) { |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 250 | struct weston_timeline_subscription_object *new_sub_obj; |
| 251 | |
| 252 | new_sub_obj = weston_timeline_subscription_surface_ensure(tm_sub, mains); |
| 253 | check_weston_surface_description(sub, mains, tm_sub, new_sub_obj); |
| 254 | if (snprintf(mainstr, sizeof(mainstr), ", \"main_surface\":%u", |
| 255 | new_sub_obj->id) < 0) |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 256 | mainstr[0] = '\0'; |
| 257 | } else { |
| 258 | mainstr[0] = '\0'; |
| 259 | } |
| 260 | |
| 261 | if (!s->get_label || s->get_label(s, d, sizeof(d)) < 0) |
| 262 | d[0] = '\0'; |
| 263 | |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 264 | weston_log_subscription_printf(sub, "{ \"id\":%u, " |
| 265 | "\"type\":\"weston_surface\", \"desc\":", |
| 266 | sub_obj->id); |
| 267 | fprint_quoted_string(sub, d[0] ? d : NULL); |
| 268 | weston_log_subscription_printf(sub, "%s }\n", mainstr); |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 269 | } |
| 270 | |
| 271 | static int |
| 272 | emit_weston_surface(struct timeline_emit_context *ctx, void *obj) |
| 273 | { |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 274 | struct weston_log_subscription *sub = ctx->subscription; |
| 275 | struct weston_surface *surface = obj; |
| 276 | struct weston_timeline_subscription_object *sub_obj; |
| 277 | struct weston_timeline_subscription *tl_sub; |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 278 | |
Marius Vlad | fb10ed7 | 2019-09-05 14:20:43 +0300 | [diff] [blame] | 279 | tl_sub = weston_log_subscription_get_data(sub); |
| 280 | sub_obj = weston_timeline_subscription_surface_ensure(tl_sub, surface); |
| 281 | check_weston_surface_description(sub, surface, tl_sub, sub_obj); |
| 282 | |
| 283 | assert(sub_obj->id != 0); |
| 284 | fprintf(ctx->cur, "\"ws\":%u", sub_obj->id); |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 285 | |
| 286 | return 1; |
| 287 | } |
| 288 | |
| 289 | static int |
| 290 | emit_vblank_timestamp(struct timeline_emit_context *ctx, void *obj) |
| 291 | { |
| 292 | struct timespec *ts = obj; |
| 293 | |
| 294 | fprintf(ctx->cur, "\"vblank\":[%" PRId64 ", %ld]", |
| 295 | (int64_t)ts->tv_sec, ts->tv_nsec); |
| 296 | |
| 297 | return 1; |
| 298 | } |
| 299 | |
Alexandros Frantzis | 75d38ef | 2017-09-27 15:09:13 +0300 | [diff] [blame] | 300 | static int |
| 301 | emit_gpu_timestamp(struct timeline_emit_context *ctx, void *obj) |
| 302 | { |
| 303 | struct timespec *ts = obj; |
| 304 | |
| 305 | fprintf(ctx->cur, "\"gpu\":[%" PRId64 ", %ld]", |
| 306 | (int64_t)ts->tv_sec, ts->tv_nsec); |
| 307 | |
| 308 | return 1; |
| 309 | } |
| 310 | |
Marius Vlad | 5de9297 | 2019-10-15 13:25:41 +0300 | [diff] [blame] | 311 | static struct weston_timeline_subscription_object * |
| 312 | weston_timeline_get_subscription_object(struct weston_log_subscription *sub, |
| 313 | void *object) |
| 314 | { |
| 315 | struct weston_timeline_subscription *tl_sub; |
| 316 | |
| 317 | tl_sub = weston_log_subscription_get_data(sub); |
| 318 | if (!tl_sub) |
| 319 | return NULL; |
| 320 | |
| 321 | return weston_timeline_subscription_search(tl_sub, object); |
| 322 | } |
| 323 | |
| 324 | WL_EXPORT void |
| 325 | weston_timeline_refresh_subscription_objects(struct weston_compositor *wc, |
| 326 | void *object) |
| 327 | { |
| 328 | struct weston_log_subscription *sub = NULL; |
| 329 | |
| 330 | while ((sub = weston_log_subscription_iterate(wc->timeline, sub))) { |
| 331 | struct weston_timeline_subscription_object *sub_obj; |
| 332 | |
| 333 | sub_obj = weston_timeline_get_subscription_object(sub, object); |
| 334 | if (sub_obj) |
| 335 | sub_obj->force_refresh = true; |
| 336 | } |
| 337 | } |
| 338 | |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 339 | typedef int (*type_func)(struct timeline_emit_context *ctx, void *obj); |
| 340 | |
| 341 | static const type_func type_dispatch[] = { |
| 342 | [TLT_OUTPUT] = emit_weston_output, |
| 343 | [TLT_SURFACE] = emit_weston_surface, |
| 344 | [TLT_VBLANK] = emit_vblank_timestamp, |
Alexandros Frantzis | 75d38ef | 2017-09-27 15:09:13 +0300 | [diff] [blame] | 345 | [TLT_GPU] = emit_gpu_timestamp, |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 346 | }; |
| 347 | |
| 348 | WL_EXPORT void |
Marius Vlad | 3203ff6 | 2019-09-05 14:56:12 +0300 | [diff] [blame] | 349 | weston_timeline_point(struct weston_log_scope *timeline_scope, |
| 350 | const char *name, ...) |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 351 | { |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 352 | struct timespec ts; |
| 353 | enum timeline_type otype; |
| 354 | void *obj; |
| 355 | char buf[512]; |
Marius Vlad | 3203ff6 | 2019-09-05 14:56:12 +0300 | [diff] [blame] | 356 | struct weston_log_subscription *sub = NULL; |
| 357 | |
| 358 | if (!weston_log_scope_is_enabled(timeline_scope)) |
| 359 | return; |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 360 | |
Marius Vlad | 2a1b786 | 2019-09-05 13:12:18 +0300 | [diff] [blame] | 361 | clock_gettime(CLOCK_MONOTONIC, &ts); |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 362 | |
Marius Vlad | 3203ff6 | 2019-09-05 14:56:12 +0300 | [diff] [blame] | 363 | while ((sub = weston_log_subscription_iterate(timeline_scope, sub))) { |
| 364 | va_list argp; |
| 365 | struct timeline_emit_context ctx = {}; |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 366 | |
Marius Vlad | 3203ff6 | 2019-09-05 14:56:12 +0300 | [diff] [blame] | 367 | memset(buf, 0, sizeof(buf)); |
| 368 | ctx.cur = fmemopen(buf, sizeof(buf), "w"); |
| 369 | ctx.subscription = sub; |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 370 | |
Marius Vlad | 3203ff6 | 2019-09-05 14:56:12 +0300 | [diff] [blame] | 371 | if (!ctx.cur) { |
| 372 | weston_log("Timeline error in fmemopen, closing.\n"); |
| 373 | return; |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 374 | } |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 375 | |
Marius Vlad | 3203ff6 | 2019-09-05 14:56:12 +0300 | [diff] [blame] | 376 | fprintf(ctx.cur, "{ \"T\":[%" PRId64 ", %ld], \"N\":\"%s\"", |
| 377 | (int64_t)ts.tv_sec, ts.tv_nsec, name); |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 378 | |
Marius Vlad | 3203ff6 | 2019-09-05 14:56:12 +0300 | [diff] [blame] | 379 | va_start(argp, name); |
| 380 | while (1) { |
| 381 | otype = va_arg(argp, enum timeline_type); |
| 382 | if (otype == TLT_END) |
| 383 | break; |
| 384 | |
| 385 | obj = va_arg(argp, void *); |
| 386 | if (type_dispatch[otype]) { |
| 387 | fprintf(ctx.cur, ", "); |
| 388 | type_dispatch[otype](&ctx, obj); |
| 389 | } |
| 390 | } |
| 391 | va_end(argp); |
| 392 | |
| 393 | fprintf(ctx.cur, " }\n"); |
| 394 | fflush(ctx.cur); |
| 395 | if (ferror(ctx.cur)) { |
| 396 | weston_log("Timeline error in constructing entry, closing.\n"); |
| 397 | } else { |
| 398 | weston_log_subscription_printf(ctx.subscription, "%s", buf); |
| 399 | } |
| 400 | |
| 401 | fclose(ctx.cur); |
| 402 | |
| 403 | } |
Pekka Paalanen | b502654 | 2014-11-12 15:09:24 +0200 | [diff] [blame] | 404 | } |