From patchwork Thu Jun 13 13:26:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzvetomir Stoyanov X-Patchwork-Id: 10992185 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 5417F15E6 for ; Thu, 13 Jun 2019 15:15:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41C9F20572 for ; Thu, 13 Jun 2019 15:15:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 35EDF212DB; Thu, 13 Jun 2019 15:15:09 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 A726C205F7 for ; Thu, 13 Jun 2019 15:15:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732238AbfFMPPI (ORCPT ); Thu, 13 Jun 2019 11:15:08 -0400 Received: from mail-eopbgr740042.outbound.protection.outlook.com ([40.107.74.42]:46048 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732236AbfFMN0Q (ORCPT ); Thu, 13 Jun 2019 09:26:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RJNBNHjVef7TvKX/EBaFfbbaOndrQ3zt+OS49/Uel8A=; b=bcUm1SYmtMPWYKRoPzHHmKRfD0nUxzfiqNY4mCDXV1LpnsBf30H6KrkKoCFpQJzzC3l2Xms1ktKPm1oXfGcuebt81Ldwbj1UXwYwZOdJlOVKUQURIch5QV5BGVs0IK/9ukslNF1KG7/DxtvGd0BBb0i1DtAZno4pSkTTSmzVvBg= Received: from DM6PR05MB4044.namprd05.prod.outlook.com (20.176.71.154) by DM6PR05MB4956.namprd05.prod.outlook.com (20.177.221.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1987.11; Thu, 13 Jun 2019 13:26:11 +0000 Received: from DM6PR05MB4044.namprd05.prod.outlook.com ([fe80::c5ce:1ccd:9894:2181]) by DM6PR05MB4044.namprd05.prod.outlook.com ([fe80::c5ce:1ccd:9894:2181%7]) with mapi id 15.20.1987.010; Thu, 13 Jun 2019 13:26:11 +0000 From: Tzvetomir Stoyanov To: "rostedt@goodmis.org" CC: "linux-trace-devel@vger.kernel.org" Subject: [PATCH v6 1/2] tools/lib/traceevent: Man pages for libtraceevent event print related API Thread-Topic: [PATCH v6 1/2] tools/lib/traceevent: Man pages for libtraceevent event print related API Thread-Index: AQHVIeuRqhEX7Ws5vUa2cvLklTGNog== Date: Thu, 13 Jun 2019 13:26:11 +0000 Message-ID: <20190613132559.24704-1-tstoyanov@vmware.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR09CA0111.eurprd09.prod.outlook.com (2603:10a6:803:78::34) To DM6PR05MB4044.namprd05.prod.outlook.com (2603:10b6:5:8f::26) authentication-results: spf=none (sender IP is ) smtp.mailfrom=tstoyanov@vmware.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.21.0 x-originating-ip: [146.247.46.5] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 14fb3c45-6817-42da-21a4-08d6f002b352 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020);SRVR:DM6PR05MB4956; x-ms-traffictypediagnostic: DM6PR05MB4956: x-ms-exchange-purlcount: 1 x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-forefront-prvs: 0067A8BA2A x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(366004)(376002)(136003)(39860400002)(346002)(396003)(199004)(189003)(1730700003)(66476007)(2351001)(2501003)(5640700003)(2906002)(73956011)(7736002)(66946007)(52116002)(66066001)(26005)(81156014)(81166006)(86362001)(71190400001)(71200400001)(66556008)(486006)(8676002)(6486002)(305945005)(64756008)(476003)(66446008)(6436002)(316002)(2616005)(8936002)(6306002)(1076003)(4326008)(14444005)(50226002)(6506007)(6916009)(256004)(186003)(5660300002)(6512007)(99286004)(68736007)(386003)(6116002)(102836004)(36756003)(3846002)(53936002)(25786009)(478600001)(14454004)(2004002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR05MB4956;H:DM6PR05MB4044.namprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: trFx+z2orozTzb7fILFlijwdl0X0hQx1Vlq0OMk+06KzpY8VKYbfdEK02xwCrTKJ0Krpvz9hzR1XmBTGjya8+P//Z1yl6VOU5sFgvT2y1t8OXv0B8xtUHqrrf6XgYp8qfaOkAtswEUYCVMiXzt0SRIt5LJ68pBf4MwunkyAwcJdamP7FoVgQcX/BE6sXxcGvLOtFRBuN84QN2eqnx0h3eMML6ONqONnO3DArpdhvrH1bbtZA9cdY/e2zx1wSA6ScvFhKDpsKn7DIYvhdIoiWe+s0wJ5Qu5jii2o/YfFCur15jmBggIXXlIDA+fGBDLusHYk0hPqoZpiAp39jmFr+LVQ/E4Vpk40gdq2Lmqdz2UIcKt8bZUQ0CftAVq8RQV5t7yPp7MnEafL5wkLxwluovDyLjRPRHn9ZiRlUq9h1klA= MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-Network-Message-Id: 14fb3c45-6817-42da-21a4-08d6f002b352 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Jun 2019 13:26:11.3665 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: tstoyanov@vmware.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR05MB4956 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 Added new man page, describing tep_print_event() libtraceevent API. Signed-off-by: Tzvetomir Stoyanov --- .../libtraceevent-event_print.txt | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 tools/lib/traceevent/Documentation/libtraceevent-event_print.txt diff --git a/tools/lib/traceevent/Documentation/libtraceevent-event_print.txt b/tools/lib/traceevent/Documentation/libtraceevent-event_print.txt new file mode 100644 index 000000000000..ddbf99b9c661 --- /dev/null +++ b/tools/lib/traceevent/Documentation/libtraceevent-event_print.txt @@ -0,0 +1,130 @@ +libtraceevent(3) +================ + +NAME +---- +tep_print_event - Writes event information into a trace sequence. + +SYNOPSIS +-------- +[verse] +-- +*#include * +*#include * + +void *tep_print_event*(struct tep_handle pass:[*]_tep_, struct trace_seqpass:[*]_s_, struct tep_record pass:[*]_record_, const char pass:[*]_fmt_, _..._) +-- + +DESCRIPTION +----------- + +The _tep_print_event()_ function parses the event information of the given +_record_ and writes it into the trace sequence _s_, according to the format +string _fmt_. The desired information is specified after the format string. +The _fmt_ is printf-like format string, following arguments are supported: +[verse] +-- + TEP_PRINT_PID, "%d" - PID of the event. + TEP_PRINT_CPU, "%d" - Event CPU. + TEP_PRINT_COMM, "%s" - Event command string. + TEP_PRINT_NAME, "%s" - Event name. + TEP_PRINT_LATENCY, "%s" - Latency of the event. It prints 4 or more + fields - interrupt state, scheduling state, + current context, and preemption count. + Field 1 is the interrupt enabled state: + d : Interrupts are disabled + . : Interrupts are enabled + X : The architecture does not support this + information + Field 2 is the "need resched" state. + N : The task is set to call the scheduler when + possible, as another higher priority task + may need to be scheduled in. + . : The task is not set to call the scheduler. + Field 3 is the context state. + . : Normal context + s : Soft interrupt context + h : Hard interrupt context + H : Hard interrupt context which triggered + during soft interrupt context. + z : NMI context + Z : NMI context which triggered during hard + interrupt context + Field 4 is the preemption count. + . : The preempt count is zero. + On preemptible kernels (where the task can be scheduled + out in arbitrary locations while in kernel context), the + preempt count, when non zero, will prevent the kernel + from scheduling out the current task. The preempt count + number is displayed when it is not zero. + Depending on the kernel, it may show other fields + (lock depth, or migration disabled, which are unique to + specialized kernels). + TEP_PRINT_TIME, %d - event time stamp. A divisor and precision can be + specified as part of this format string: + "%precision.divisord". Example: + "%3.1000d" - divide the time by 1000 and print the first + 3 digits before the dot. Thus, the time stamp + "123456000" will be printed as "123.456" + TEP_PRINT_INFO, "%s" - event information. If any width is specified in + the format string, the event information will be + printed in raw format. +-- +EXAMPLE +------- +[source,c] +-- +#include +#include +... +struct trace_seq seq; +trace_seq_init(&seq); +struct tep_handle *tep = tep_alloc(); +... +void print_my_event(struct tep_record *record) +{ + trace_seq_reset(&seq); + tep_print_event(tep, s, record, "%16s-%-5d [%03d] %s %6.1000d %s %s", + TEP_PRINT_COMM, TEP_PRINT_PID, TEP_PRINT_CPU, + TEP_PRINT_LATENCY, TEP_PRINT_TIME, TEP_PRINT_NAME, + TEP_PRINT_INFO); +} +... +-- + +FILES +----- +[verse] +-- +*event-parse.h* + Header file to include in order to have access to the library APIs. +*trace-seq.h* + Header file to include in order to have access to trace sequences related APIs. + Trace sequences are used to allow a function to call several other functions + to create a string of data to use. +*-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