From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Elisp native profiler Date: Tue, 02 Oct 2012 08:58:47 -0400 Message-ID: References: <83zk4egs0w.fsf@gnu.org> <83y5jygrni.fsf@gnu.org> <50620443.8050301@cs.ucla.edu> <20120926151625.229ef3cc9caf90e5098b18ef@cx4a.org> <20121001014217.03ac31a69b9b43516cb0dd61@cx4a.org> <50689C1D.8080005@cs.ucla.edu> <5068AEE2.4080004@cs.ucla.edu> <5068F696.7040600@cs.ucla.edu> <83txueb63s.fsf@gnu.org> <5069C7C1.7040206@cs.ucla.edu> <83a9w6axlk.fsf@gnu.org> <83391xbk1m.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1349182784 13443 80.91.229.3 (2 Oct 2012 12:59:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 2 Oct 2012 12:59:44 +0000 (UTC) Cc: tomo@cx4a.org, eggert@cs.ucla.edu, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 02 14:59:48 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TJ249-0006OR-CK for ged-emacs-devel@m.gmane.org; Tue, 02 Oct 2012 14:59:13 +0200 Original-Received: from localhost ([::1]:42630 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ243-00030X-QL for ged-emacs-devel@m.gmane.org; Tue, 02 Oct 2012 08:59:07 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:40379) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ241-0002zY-0k for emacs-devel@gnu.org; Tue, 02 Oct 2012 08:59:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJ23u-0005h0-SX for emacs-devel@gnu.org; Tue, 02 Oct 2012 08:59:04 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:3714) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJ23l-0005cp-0i; Tue, 02 Oct 2012 08:58:49 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09FxLT4/2dsb2JhbABEtBGBCIIVAQEEAVYjEAs0EhQYDSSIHAW6CZBEA6MzgViDBYE6GQ X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="200449311" Original-Received: from 69-196-180-248.dsl.teksavvy.com (HELO pastel.home) ([69.196.180.248]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 02 Oct 2012 08:58:47 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 7B673594CC; Tue, 2 Oct 2012 08:58:47 -0400 (EDT) In-Reply-To: <83391xbk1m.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 02 Oct 2012 06:00:05 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.182 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:153902 Archived-At: >> > In a nutshell, that thread sleeps until the timer expiration, then >> > suspends the main thread, calls the SIGPROF handler, resumes the main >> > thread, and goes back to sleep. The deviation from the Posix >> > semantics is that the handler runs in the context of a thread other >> > than the main thread. >> Isn't there another difference in that your code samples at a rate >> determined by the wall-clock time rather than the cpu-time of the process? > The timer thread is part of the process, so whenever it runs, the > process runs. > Or maybe I don't understand what you mean, exactly. If your profiler is set to sample every 10ms and your Emacs process uses 50% of the CPU, how many samples will you get after 1s: 100 or 50? And if Emacs is idle waiting for user input, after 1s will you get 100 samples or 0? Under GNU/Linux (at least with the "old" setitimer code) you'd have gotten 50 and 0 respectively. Stefan