From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id b89bMCJKBmMCoSwAWB0awg (envelope-from ) for ; Wed, 24 Aug 2022 11:56:18 -0400 Received: by simark.ca (Postfix, from userid 112) id B7F001E4A7; Wed, 24 Aug 2022 11:56:18 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=lists.lttng.org header.i=@lists.lttng.org header.a=rsa-sha256 header.s=default header.b=iYZwmmUK; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.lttng.org (lists.lttng.org [167.114.26.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id E4B951E21F for ; Wed, 24 Aug 2022 11:56:17 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.lttng.org; s=default; t=1661356577; bh=7/Iv6rr3z3aDMj87+cAJ8rapmiQubTAe8YYbth79TBg=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=iYZwmmUKBhuk83ZrUmMqffRkBrjVTg9Utv8InWpmPLIV7ARJ8mzffNm7bp6fkp3MC AzIxPZQB1fwtzZXnRK1PHq8G1T5nKw+laN1y8DKQ56dSdpkY0MGVPJhUWESXHzBTpq y+H8ZbLSAeiEFPEafXv773CmYgSGTG/hguOb0UytHj+WrYut/3jH4QLT8ogeJpDGgX qOYwjNYMa8/Ft7bbTwhxFSJdkinStAawXykBshr2PddxBuv0NnPtLv+aJ4mVTxm+/+ zW+hNu54r4oAyDo1cCUG+21GPwYGitDwpruxG25jLdLDrUjMxHmZMZh2wqmYaXYZ+v AuqlJtqpieQbw== Received: from lists-lttng01.efficios.com (localhost [IPv6:::1]) by lists.lttng.org (Postfix) with ESMTP id 4MCW0x3LCbz1MZy; Wed, 24 Aug 2022 11:56:17 -0400 (EDT) Received: from simark.ca (simark.ca [158.69.221.121]) by lists.lttng.org (Postfix) with ESMTPS id 4MCW0w2vcQz1N6W for ; Wed, 24 Aug 2022 11:56:16 -0400 (EDT) Received: from [172.16.0.64] (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 9D0A51E21F; Wed, 24 Aug 2022 11:56:09 -0400 (EDT) Message-ID: <9464af1b-abd9-16ad-886d-d1bfb7a88b8d@simark.ca> Date: Wed, 24 Aug 2022 11:56:09 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Content-Language: fr To: Maksim Khmelevskiy Cc: lttng-dev@lists.lttng.org References: <87a1bad5-9942-3d6a-9726-1e4e74bea4d2@simark.ca> In-Reply-To: Subject: Re: [lttng-dev] C API message iterator example for libbabeltrace2 X-BeenThere: lttng-dev@lists.lttng.org X-Mailman-Version: 2.1.39 Precedence: list List-Id: LTTng development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via lttng-dev Reply-To: Simon Marchi Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: lttng-dev-bounces@lists.lttng.org Sender: "lttng-dev" On 8/20/22 12:14, Maksim Khmelevskiy via lttng-dev wrote: > Hi Simon, > thanks for the reply! > What I came up with for now is this example > . > It's probably has a lot of design mistakes but it's at least runnable. Looks like a good prototype, it seems right. Some hopefully constructive comments: - You can probably use bt_plugin_find to find a plugin by name instead of your code that does it by hand - When you instantiate a src.ctf.fs component, it may have more than one port (there is one port per data stream), in which case you want to connect them all to a flt.utils.muxer component (which is what the CLI and the Python TraceCollectionMessageIterator class do) to funnel all the messages to a single output port. Of course, if you know the CTF traces you deal with have a single data stream, that is not necessary. > I also see that examples for C API aren't build, but maybe I'm wrong. C API examples in the documentation indeed aren't built. > Another thing, if you have lack of resources I would be happy to help, I could make a PR with your guidance and review. > > Answers to the questions: > 1) Not sure that I completely understand the question, I wanted to parse events(name, fields), not the metadata file aligned with the CTF trace file. > 2) Because I wanted to get C-structs directly from the CTF traces. I'm sure that it's very niche requirement, sane people would not need it. > 3) I would do something like that, but I have a requirement of providing C structs. I guess to apply filters or do something else with traces (I'm not sure, not my idea, but I also find it weird) Ok, I understand. When you said you need to write "C structs", I thought you meant that you needed to output some generated C code, for instance convert event types to structures, for use in a program later. But that's not the case, you want to take event payload and fill out some structures at runtime, from what I can see. That explains why you want to use the C API and why you want to create and run a graph in your own application. Following your questions, I have written an example of creating and running a graph, which I just submitted for review here: https://review.lttng.org/c/babeltrace/+/8741 It is roughly equivalent to this Python example: https://babeltrace.org/docs/v2.0/python/bt2/examples.html#build-and-run-a-trace-processing-graph Simon _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev