xref: /kernel/linux/linux-6.6/tools/perf/trace/beauty/timespec.c
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-6.6/tools/perf/trace/beauty/
162306a36Sopenharmony_ci// SPDX-License-Identifier: LGPL-2.1
262306a36Sopenharmony_ci// Copyright (C) 2022, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#include "trace/beauty/beauty.h"
562306a36Sopenharmony_ci#include <inttypes.h>
662306a36Sopenharmony_ci#include <time.h>
762306a36Sopenharmony_ci
862306a36Sopenharmony_cistatic size_t syscall_arg__scnprintf_augmented_timespec(struct syscall_arg *arg, char *bf, size_t size)
962306a36Sopenharmony_ci{
1062306a36Sopenharmony_ci	struct timespec *ts = (struct timespec *)arg->augmented.args;
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci	return scnprintf(bf, size, "{ .tv_sec: %" PRIu64 ", .tv_nsec: %" PRIu64 " }", ts->tv_sec, ts->tv_nsec);
1362306a36Sopenharmony_ci}
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cisize_t syscall_arg__scnprintf_timespec(char *bf, size_t size, struct syscall_arg *arg)
1662306a36Sopenharmony_ci{
1762306a36Sopenharmony_ci	if (arg->augmented.args)
1862306a36Sopenharmony_ci		return syscall_arg__scnprintf_augmented_timespec(arg, bf, size);
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci	return scnprintf(bf, size, "%#lx", arg->val);
2162306a36Sopenharmony_ci}
22

Indexes created Thu Nov 07 10:32:03 CST 2024