public inbox for ecos-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug 1001605] New: much faster and simpler(!) replacement for _simple_mktime() (in wallclock.inl)
@ 2012-06-01  8:57 bugzilla-daemon
  2012-06-01  8:58 ` [Bug 1001605] " bugzilla-daemon
  0 siblings, 1 reply; 2+ messages in thread
From: bugzilla-daemon @ 2012-06-01  8:57 UTC (permalink / raw)
  To: unassigned

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001605

           Summary: much faster and simpler(!) replacement for
                    _simple_mktime() (in wallclock.inl)
           Product: eCos
           Version: CVS
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: low
         Component: Wallclock
        AssignedTo: unassigned@bugs.ecos.sourceware.org
        ReportedBy: bernard.fouche@kuantic.com
                CC: ecos-bugs@ecos.sourceware.org
             Class: Advice Request


If _simple_mktime() is called for Dec 31st 2012, it will do:

  42 (2012-1970) additions of a value requiring 3 modulo's
+ 12 additions (of the month)
+ 1 substraction
+ 3 multiplications and 3 additions

That is a total of (42*3)+12+1+(3+3)=145 operations.

The proposed change makes _simple_mktime() to use:

- 1 substraction, 1 multiplication, 1 addition and 1 substraction to calculate
a 'base' second value.
- 1 comparison that can lead to 1 substraction
- 1 addition, 1 substraction, 1 division
- 2 substractions, 1 division
- 1 addition, 1 substraction, 1 division
- 1 addition
- 1 substraction
- 1 multiplication
- 1 addition
- 1 multiplication
- 1 addition
- 1 multiplication
- 1 addition

That is a total of:

(1+1+1+1)+(1+1)+(1+1+1)+(2+1)+(1+1+1)+1+1+1+1+1+1+1+1=23 operations.

This count is nearly always the same whatever the time/date processed, which is
not the case for the original code, which takes 3 modulo's more per invocation
each year, since this function is called by all RTC HW drivers.

I don't think eCos runs on MCU/CPU without HW division, but in such a case this
would mean that 2/3rd of the modulo's in the current code are also done in
software (for 100 and 400 values).

I attach an example of the proposed replacement code that compiles under Linux
and uses brute force to check all possible values: it takes about 6 minutes to
run in a recent computer.

If someone can review and accept this small code change, I can make a patch vs
ecos/packages/io/wallclock/current/include/wallclock/wallclock.inl

  Bernard

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug 1001605] much faster and simpler(!) replacement for _simple_mktime() (in wallclock.inl)
  2012-06-01  8:57 [Bug 1001605] New: much faster and simpler(!) replacement for _simple_mktime() (in wallclock.inl) bugzilla-daemon
@ 2012-06-01  8:58 ` bugzilla-daemon
  0 siblings, 0 replies; 2+ messages in thread
From: bugzilla-daemon @ 2012-06-01  8:58 UTC (permalink / raw)
  To: unassigned

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001605

--- Comment #1 from Bernard Fouché <bernard.fouche@kuantic.com> 2012-06-01 09:58:17 BST ---
Created an attachment (id=1781)
 --> (http://bugs.ecos.sourceware.org/attachment.cgi?id=1781)
Demo code running under Linux for the proposed changes.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
>From ecos-bugs-return-9563-listarch-ecos-bugs=sources.redhat.com@sourceware.org Fri Jun 01 08:58:35 2012
Return-Path: <ecos-bugs-return-9563-listarch-ecos-bugs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-ecos-bugs@sources.redhat.com
Received: (qmail 24960 invoked by alias); 1 Jun 2012 08:58:34 -0000
Received: (qmail 24941 invoked by uid 22791); 1 Jun 2012 08:58:33 -0000
X-SWARE-Spam-Status: No, hits=-2.7 required=5.0
	tests=AWL,BAYES_00,KHOP_THREADED
X-Spam-Check-By: sourceware.org
Received: from hagrid.ecoscentric.com (HELO mail.ecoscentric.com) (212.13.207.197)
    by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Jun 2012 08:58:21 +0000
Received: from localhost (hagrid.ecoscentric.com [127.0.0.1])
	by mail.ecoscentric.com (Postfix) with ESMTP id 28D492F78008
	for <ecos-bugs@ecos.sourceware.org>; Fri,  1 Jun 2012 09:58:20 +0100 (BST)
Received: from mail.ecoscentric.com ([127.0.0.1])
	by localhost (hagrid.ecoscentric.com [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id VAtTSMLsISLF; Fri,  1 Jun 2012 09:58:19 +0100 (BST)
From: bugzilla-daemon@bugs.ecos.sourceware.org
To: ecos-bugs@ecos.sourceware.org
Subject: [Bug 1001605] much faster and simpler(!) replacement for
 _simple_mktime() (in wallclock.inl)
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: eCos
X-Bugzilla-Component: Wallclock
X-Bugzilla-Keywords:
X-Bugzilla-Severity: enhancement
X-Bugzilla-Who: bernard.fouche@kuantic.com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: low
X-Bugzilla-Assigned-To: unassigned@bugs.ecos.sourceware.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
In-Reply-To: <bug-1001605-13@http.bugs.ecos.sourceware.org/>
References: <bug-1001605-13@http.bugs.ecos.sourceware.org/>
X-Bugzilla-URL: http://bugs.ecos.sourceware.org/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Date: Fri, 01 Jun 2012 08:58:00 -0000
Message-Id: <20120601085819.064F52F78007@mail.ecoscentric.com>
Mailing-List: contact ecos-bugs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <ecos-bugs.sourceware.org>
List-Subscribe: <mailto:ecos-bugs-subscribe@sourceware.org>
List-Post: <mailto:ecos-bugs@sourceware.org>
List-Help: <mailto:ecos-bugs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: ecos-bugs-owner@sourceware.org
Delivered-To: mailing list ecos-bugs@sourceware.org
X-SW-Source: 2012/txt/msg00992.txt.bz2
Content-length: 555

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001605

--- Comment #1 from Bernard Fouché <bernard.fouche@kuantic.com> 2012-06-01 09:58:17 BST ---
Created an attachment (id=1781)
 --> (http://bugs.ecos.sourceware.org/attachment.cgi?id=1781)
Demo code running under Linux for the proposed changes.

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
>From ecos-bugs-return-9564-listarch-ecos-bugs=sources.redhat.com@sourceware.org Fri Jun 01 09:01:38 2012
Return-Path: <ecos-bugs-return-9564-listarch-ecos-bugs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-ecos-bugs@sources.redhat.com
Received: (qmail 26604 invoked by alias); 1 Jun 2012 09:01:38 -0000
Received: (qmail 26593 invoked by uid 22791); 1 Jun 2012 09:01:37 -0000
X-SWARE-Spam-Status: No, hits=-2.7 required=5.0
	tests=AWL,BAYES_00,KHOP_THREADED
X-Spam-Check-By: sourceware.org
Received: from hagrid.ecoscentric.com (HELO mail.ecoscentric.com) (212.13.207.197)
    by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Jun 2012 09:01:25 +0000
Received: from localhost (hagrid.ecoscentric.com [127.0.0.1])
	by mail.ecoscentric.com (Postfix) with ESMTP id 27D622F78001
	for <ecos-bugs@ecos.sourceware.org>; Fri,  1 Jun 2012 10:01:24 +0100 (BST)
Received: from mail.ecoscentric.com ([127.0.0.1])
	by localhost (hagrid.ecoscentric.com [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id uHpxywMTCDJs; Fri,  1 Jun 2012 10:01:24 +0100 (BST)
From: bugzilla-daemon@bugs.ecos.sourceware.org
To: ecos-bugs@ecos.sourceware.org
Subject: [Bug 1001456] HAL misses Interrupt Clear-Pending Registers handling:
 wasted processing power
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: eCos
X-Bugzilla-Component: HAL
X-Bugzilla-Keywords:
X-Bugzilla-Severity: major
X-Bugzilla-Who: bernard.fouche@kuantic.com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: low
X-Bugzilla-Assigned-To: unassigned@bugs.ecos.sourceware.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
In-Reply-To: <bug-1001456-13@http.bugs.ecos.sourceware.org/>
References: <bug-1001456-13@http.bugs.ecos.sourceware.org/>
X-Bugzilla-URL: http://bugs.ecos.sourceware.org/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Date: Fri, 01 Jun 2012 09:01:00 -0000
Message-Id: <20120601090116.94D072F7800A@mail.ecoscentric.com>
Mailing-List: contact ecos-bugs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <ecos-bugs.sourceware.org>
List-Subscribe: <mailto:ecos-bugs-subscribe@sourceware.org>
List-Post: <mailto:ecos-bugs@sourceware.org>
List-Help: <mailto:ecos-bugs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: ecos-bugs-owner@sourceware.org
Delivered-To: mailing list ecos-bugs@sourceware.org
X-SW-Source: 2012/txt/msg00993.txt.bz2
Content-length: 438

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001456

--- Comment #23 from Bernard Fouché <bernard.fouche@kuantic.com> 2012-06-01 10:01:04 BST ---
Some Day My Prince Will Come... :-)

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
>From ecos-bugs-return-9565-listarch-ecos-bugs=sources.redhat.com@sourceware.org Fri Jun 01 09:01:52 2012
Return-Path: <ecos-bugs-return-9565-listarch-ecos-bugs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-ecos-bugs@sources.redhat.com
Received: (qmail 26692 invoked by alias); 1 Jun 2012 09:01:50 -0000
Received: (qmail 26684 invoked by uid 22791); 1 Jun 2012 09:01:50 -0000
X-SWARE-Spam-Status: No, hits=-2.8 required=5.0
	tests=AWL,BAYES_00,KHOP_THREADED,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Received: from hagrid.ecoscentric.com (HELO mail.ecoscentric.com) (212.13.207.197)
    by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Jun 2012 09:01:27 +0000
Received: by mail.ecoscentric.com (Postfix, from userid 48)
	id 64AE02F78009; Fri,  1 Jun 2012 10:01:26 +0100 (BST)
X-Original-To: unassigned@bugs.ecos.sourceware.org
Delivered-To: unassigned@bugs.ecos.sourceware.org
From: bugzilla-daemon@bugs.ecos.sourceware.org
To: unassigned@bugs.ecos.sourceware.org
Subject: [Bug 1001456] HAL misses Interrupt Clear-Pending Registers handling:
 wasted processing power
X-Bugzilla-Reason: AssignedTo
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: eCos
X-Bugzilla-Component: HAL
X-Bugzilla-Keywords:
X-Bugzilla-Severity: major
X-Bugzilla-Who: bernard.fouche@kuantic.com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: low
X-Bugzilla-Assigned-To: unassigned@bugs.ecos.sourceware.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
In-Reply-To: <bug-1001456-777@http.bugs.ecos.sourceware.org/>
References: <bug-1001456-777@http.bugs.ecos.sourceware.org/>
X-Bugzilla-URL: http://bugs.ecos.sourceware.org/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Date: Fri, 01 Jun 2012 09:01:00 -0000
Message-Id: <20120601090116.794492F78009@mail.ecoscentric.com>
Mailing-List: contact ecos-bugs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <ecos-bugs.sourceware.org>
List-Subscribe: <mailto:ecos-bugs-subscribe@sourceware.org>
List-Post: <mailto:ecos-bugs@sourceware.org>
List-Help: <mailto:ecos-bugs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: ecos-bugs-owner@sourceware.org
Delivered-To: mailing list ecos-bugs@sourceware.org
X-SW-Source: 2012/txt/msg00994.txt.bz2
Content-length: 436

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001456

--- Comment #23 from Bernard Fouché <bernard.fouche@kuantic.com> 2012-06-01 10:01:04 BST ---
Some Day My Prince Will Come... :-)

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
>From ecos-bugs-return-9567-listarch-ecos-bugs=sources.redhat.com@sourceware.org Fri Jun 01 09:14:59 2012
Return-Path: <ecos-bugs-return-9567-listarch-ecos-bugs=sources.redhat.com@sourceware.org>
Delivered-To: listarch-ecos-bugs@sources.redhat.com
Received: (qmail 32108 invoked by alias); 1 Jun 2012 09:14:58 -0000
Received: (qmail 32100 invoked by uid 22791); 1 Jun 2012 09:14:57 -0000
X-SWARE-Spam-Status: No, hits=-2.7 required=5.0
	tests=AWL,BAYES_00,KHOP_THREADED
X-Spam-Check-By: sourceware.org
Received: from hagrid.ecoscentric.com (HELO mail.ecoscentric.com) (212.13.207.197)
    by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 01 Jun 2012 09:14:43 +0000
Received: from localhost (hagrid.ecoscentric.com [127.0.0.1])
	by mail.ecoscentric.com (Postfix) with ESMTP id D0C082F78009
	for <ecos-bugs@ecos.sourceware.org>; Fri,  1 Jun 2012 10:14:42 +0100 (BST)
Received: from mail.ecoscentric.com ([127.0.0.1])
	by localhost (hagrid.ecoscentric.com [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id HsESbvz5hDBU; Fri,  1 Jun 2012 10:14:40 +0100 (BST)
From: bugzilla-daemon@bugs.ecos.sourceware.org
To: ecos-bugs@ecos.sourceware.org
Subject: [Bug 1000155] Added new options for SPARC LEON to ecos.db
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: eCos
X-Bugzilla-Component: HAL
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ecos@astekk.se
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: normal
X-Bugzilla-Assigned-To: backlog@bugs.ecos.sourceware.org
X-Bugzilla-Target-Milestone: 2.0 Final
X-Bugzilla-Changed-Fields:
In-Reply-To: <bug-1000155-13@http.bugs.ecos.sourceware.org/>
References: <bug-1000155-13@http.bugs.ecos.sourceware.org/>
X-Bugzilla-URL: http://bugs.ecos.sourceware.org/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
Date: Fri, 01 Jun 2012 09:14:00 -0000
Message-Id: <20120601091436.6A5472F78008@mail.ecoscentric.com>
Mailing-List: contact ecos-bugs-help@sourceware.org; run by ezmlm
Precedence: bulk
List-Id: <ecos-bugs.sourceware.org>
List-Subscribe: <mailto:ecos-bugs-subscribe@sourceware.org>
List-Post: <mailto:ecos-bugs@sourceware.org>
List-Help: <mailto:ecos-bugs-help@sourceware.org>, <http://sourceware.org/lists.html#faqs>
Sender: ecos-bugs-owner@sourceware.org
Delivered-To: mailing list ecos-bugs@sourceware.org
X-SW-Source: 2012/txt/msg00996.txt.bz2
Content-length: 608

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id\x1000155

--- Comment #2 from Andreas Stenius <ecos@astekk.se> 2012-06-01 10:14:34 BST ---
Created an attachment (id\x1782)
 --> (http://bugs.ecos.sourceware.org/attachment.cgi?id\x1782)
File date: 2006-07-07, 656Kb.

This is the latest version (1.0.7) found at
ftp://gaisler.com/gaisler.com/ecos/src/patches at this time.

--
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-01  8:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-01  8:57 [Bug 1001605] New: much faster and simpler(!) replacement for _simple_mktime() (in wallclock.inl) bugzilla-daemon
2012-06-01  8:58 ` [Bug 1001605] " bugzilla-daemon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).