From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18070 invoked by alias); 27 Jan 2015 11:17:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 17855 invoked by uid 89); 27 Jan 2015 11:17:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 27 Jan 2015 11:17:38 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0RBHaw2023287 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 27 Jan 2015 06:17:36 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t0RBHYMs003733; Tue, 27 Jan 2015 06:17:35 -0500 Message-ID: <54C773CE.8040708@redhat.com> Date: Tue, 27 Jan 2015 15:31:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Markus Metzger CC: gdb-patches@sourceware.org Subject: Re: [PATCH v2 03/13] btrace, linux: add perf event buffer abstraction References: <1416480444-9943-1-git-send-email-markus.t.metzger@intel.com> <1416480444-9943-4-git-send-email-markus.t.metzger@intel.com> In-Reply-To: <1416480444-9943-4-git-send-email-markus.t.metzger@intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-01/txt/msg00720.txt.bz2 On 11/20/2014 10:47 AM, Markus Metzger wrote: > - volatile struct perf_event_mmap_page *header; > + struct perf_event_buffer *pevent; > const uint8_t *begin, *end, *start; > - unsigned long data_head, data_tail, retries = 5; > - size_t buffer_size, size; > + unsigned long long data_head, data_tail, buffer_size, size; > + size_t retries = 5; I notice that this is changing types from long to long long. Also, a bit odd that retries is now size_t, given it's just a counter. > +#if HAVE_LINUX_PERF_EVENT_H > +/* A Linux perf event buffer. */ > +struct perf_event_buffer > +{ > + /* The mapped memory. */ > + const uint8_t *mem; > + > + /* The size of the mapped memory in bytes. */ > + unsigned long long size; > + > + /* A pointer to the data_head field for this buffer. */ > + volatile unsigned long long *data_head; > + > + /* The data_head value from the last read. */ > + unsigned long long last_head; > +}; Isn't there a better type to use here instead of "long long"? Why not size_t, if a host buffer size; uint64_t, if it's a fixed buffer format, assuming 64-bit here; or ULONGEST, the widest integer we support? > +#endif /* HAVE_LINUX_PERF_EVENT_H */ Thanks, Pedro Alves