From patchwork Fri Apr 12 13:38:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzvetomir Stoyanov X-Patchwork-Id: 10898353 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B61E1515 for ; Fri, 12 Apr 2019 13:38:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F22B28EEA for ; Fri, 12 Apr 2019 13:38:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 63EA428EF6; Fri, 12 Apr 2019 13:38:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 937E128EEA for ; Fri, 12 Apr 2019 13:38:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726998AbfDLNic (ORCPT ); Fri, 12 Apr 2019 09:38:32 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:37924 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726865AbfDLNic (ORCPT ); Fri, 12 Apr 2019 09:38:32 -0400 Received: by mail-wm1-f65.google.com with SMTP id w15so11076221wmc.3 for ; Fri, 12 Apr 2019 06:38:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=c7OpjGTjS/0SCcfU9EFvP5Z6UhyFladJ5cnJxnD1qJs=; b=oPwmMctF+E2IlbNDFImr9J07zFoKz8yXRW0JaHJAJsrK13hTlvA87bHthHCz92Nd9Y 4s3IqCGTBR5axHiTrVxaei9XJG84fBGxpLXKmEPt9+R/ZV62wdJBqA+FFt+aeuTHEPZC NAcJMOBwpmj4D9OohyWkhS0W9DcZbPt7Ns0Ddcenoy+oUnvROo3ktWowy6/ykwAo2ceC vASrc8SrbeTM8fgRrGtTwpKHm5oGcocRfhhrU1MTf6QEaruYG43KNgu2yreo2ckwDVX7 1o5GnwQp/C1T454tVj5OJ4+wrFPmChBlQrAIF7uPcdieIN1f3FqR3f7/sMrqG9wiEwyS TnBg== X-Gm-Message-State: APjAAAVH5rItIo+Ip8pUMkyujtbXnk1Tx8GbJcTPGN/evlQgds1dtjVB R+jPoMMWYgcuWxDg+XecIfFBGvaf X-Google-Smtp-Source: APXvYqxEnJ+PAkqjiR6pjsqjSoHIqTDJ3JX1aUw2jNjWClfecRHZf3kU6rCOwbapcuENVvVzxdzD0g== X-Received: by 2002:a1c:a9cb:: with SMTP id s194mr11578754wme.62.1555076310064; Fri, 12 Apr 2019 06:38:30 -0700 (PDT) Received: from oberon.eng.vmware.com ([146.247.46.5]) by smtp.gmail.com with ESMTPSA id x205sm11594682wmg.9.2019.04.12.06.38.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Apr 2019 06:38:29 -0700 (PDT) From: Tzvetomir Stoyanov To: rostedt@goodmis.org Cc: linux-trace-devel@vger.kernel.org Subject: [PATCH v5 19/30] tools/lib/traceevent: Man pages find field APIs Date: Fri, 12 Apr 2019 16:38:00 +0300 Message-Id: <20190412133811.15878-20-tstoyanov@vmware.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190412133811.15878-1-tstoyanov@vmware.com> References: <20190412133811.15878-1-tstoyanov@vmware.com> MIME-Version: 1.0 Sender: linux-trace-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-trace-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Create man pages for libtraceevent APIs: tep_find_common_field(), tep_find_field() tep_find_any_field() Signed-off-by: Tzvetomir Stoyanov --- .../libtraceevent-field_find.txt | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 tools/lib/traceevent/Documentation/libtraceevent-field_find.txt diff --git a/tools/lib/traceevent/Documentation/libtraceevent-field_find.txt b/tools/lib/traceevent/Documentation/libtraceevent-field_find.txt new file mode 100644 index 000000000000..0896af5b9eff --- /dev/null +++ b/tools/lib/traceevent/Documentation/libtraceevent-field_find.txt @@ -0,0 +1,118 @@ +libtraceevent(3) +================ + +NAME +---- +tep_find_common_field, tep_find_field, tep_find_any_field - +Search for a field in an event. + +SYNOPSIS +-------- +[verse] +-- +*#include * + +struct tep_format_field pass:[*]*tep_find_common_field*(struct tep_event pass:[*]_event_, const char pass:[*]_name_); +struct tep_format_field pass:[*]*tep_find_field*(struct tep_event_ormat pass:[*]_event_, const char pass:[*]_name_); +struct tep_format_field pass:[*]*tep_find_any_field*(struct tep_event pass:[*]_event_, const char pass:[*]_name_); +-- + +DESCRIPTION +----------- +These functions search for a field with given name in an event. The field +returned can be used to find the field content from within a data record. + +The _tep_find_common_field()_ function searches for a common field with _name_ +in the _event_. + +The _tep_find_field()_ function searches for an event specific field with +_name_ in the _event_. + +The _tep_find_any_field()_ function searches for any field with _name_ in the +_event_. + +RETURN VALUE +------------ +The _tep_find_common_field(), _tep_find_field()_ and _tep_find_any_field()_ +functions return a pointer to the found field, or NULL in case there is no field +with the requested name. + +EXAMPLE +------- +[source,c] +-- +#include +... +void get_htimer_info(struct tep_handle *tep, struct tep_record *record) +{ + struct tep_format_field *field; + struct tep_event *event; + long long softexpires; + int mode; + int pid; + + event = tep_find_event_by_name(tep, "timer", "hrtimer_start"); + + field = tep_find_common_field(event, "common_pid"); + if (field == NULL) { + /* Cannot find "common_pid" field in the event */ + } else { + /* Get pid from the data record */ + pid = tep_read_number(tep, record->data + field->offset, + field->size); + } + + field = tep_find_field(event, "softexpires"); + if (field == NULL) { + /* Cannot find "softexpires" event specific field in the event */ + } else { + /* Get softexpires parameter from the data record */ + softexpires = tep_read_number(tep, record->data + field->offset, + field->size); + } + + field = tep_find_any_field(event, "mode"); + if (field == NULL) { + /* Cannot find "mode" field in the event */ + } else + { + /* Get mode parameter from the data record */ + mode = tep_read_number(tep, record->data + field->offset, + field->size); + } +} +... +-- + +FILES +----- +[verse] +-- +*event-parse.h* + Header file to include in order to have access to the library APIs. +*-ltraceevent* + Linker switch to add when building a program that uses the library. +-- + +SEE ALSO +-------- +_libtraceevent(3)_, _trace-cmd(1)_ + +AUTHOR +------ +[verse] +-- +*Steven Rostedt* , author of *libtraceevent*. +*Tzvetomir Stoyanov* , author of this man page. +-- +REPORTING BUGS +-------------- +Report bugs to + +LICENSE +------- +libtraceevent is Free Software licensed under the GNU LGPL 2.1 + +RESOURCES +--------- +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git