Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Graeme Geldenhuys
On 2014-05-20 04:44, Tom Lisjac wrote:
>>
>> Maybe EpikTimer should move to the Git repo of Lazarus-CCR so others
>> could easily clone and share their feature branches (say via Github).
>>
>>
> Fully agree... great idea!

I'll let you take care of that then I don't have access to create a
new bare git repo in Lazarus-CCR.

In the mean time, I created a Git clone from the SubVersion Lazarus-CCR
which contains the full history for EpikTimer (as of this morning). I
published that at my Github account as the "master" branch.

I then created another branch called "gg-changes" which contains some of
my changes. I have multiple copies of EpikTimer on my various systems -
I'll go through them all to collect all other changes too.

Here is a pull request summary:

=
The following changes since commit 9024600e (master):

  Patch from Denis Golovan to fix epiktimer compilation in 32bit unixes
(2010-09-15 06:40:58 +)

are available in the git repository at:

  https://github.com/graemeg/epiktimer.git gg-changes

for you to fetch changes up to 79a9a8dd:

  Adds git helper files to keep the repo clean (2014-05-20 06:29:28 +0100)


Graeme Geldenhuys (8):
  Replaced magic numbers with constants
  Removed redundant x86_64 SystemSleep() code.
  minor code formatting - making it easier to read.
  using a high resolution system kernel timer.
  Replaces low-level do_syscall with clock_gettime instead
  Fixes compilation under FreeBSD
  Updates the unit copyright notice.
  Adds git helper files to keep the repo clean

 .gitattributes |  27 +
 .gitignore |   9 +++
 epiktimer.pas  | 102 +
 3 files changed, 92 insertions(+), 46 deletions(-)
 create mode 100644 .gitattributes
 create mode 100644 .gitignore

=


Once you have setup a bare git repo on Lazarus-CCR you should be able to
clone my Github one, and simply push it to Lazarus-CCR to retain the
full history (at least the "master" branch). My "gg-changes" branch is
obviously up to you.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Tom Lisjac
> Tom and I would welcome patches for EpikTimer.
>
> Maybe EpikTimer should move to the Git repo of Lazarus-CCR so others
> could easily clone and share their feature branches (say via Github).
>
>
Fully agree... great idea!

-Tom


>
> --
> ___
> Lazarus mailing list
> Lazarus@lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Graeme Geldenhuys
On 2014-05-19 18:54, Graeme Geldenhuys wrote:
> On 2014-05-19 11:03, Michael Schnell wrote:
>> Obviously I can't _use_ EpricTimer there, as it uses (IMHO 
>> inappropriately) (graphics-) stuff that is not implemented in a non-GUI 
>> project.
> 
> You are clearly using a very outdated version. That was fixed 2+ years
> ago.

Correction, it was fixed 4 years ago. :)


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Graeme Geldenhuys
On 2014-05-19 09:03, Michael Schnell wrote:
> On 05/18/2014 08:10 PM, Graeme Geldenhuys wrote:
>> {$IFDEF Windows}
>> begin
>>QueryPerformanceCounter(Result);
> Did you check that this is a low overhead function ?

You are welcome to test yourself. Google Search will show you that that
is the recommended high-precision timing option under Windows.

> It seems that a syscall is not necessary with some / many environments.
> 
> vDSO seems to provide a user-land implementation in (many) current 
> Kernel versions.

Tom and I would welcome patches for EpikTimer.

Maybe EpikTimer should move to the Git repo of Lazarus-CCR so others
could easily clone and share their feature branches (say via Github).


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Tom Lisjac
On Mon, May 19, 2014 at 11:54 AM, Graeme Geldenhuys <
mailingli...@geldenhuys.co.uk> wrote:

> On 2014-05-19 11:03, Michael Schnell wrote:
> > Obviously I can't _use_ EpricTimer there, as it uses (IMHO
> > inappropriately) (graphics-) stuff that is not implemented in a non-GUI
> > project.
>
> You are clearly using a very outdated version. That was fixed 2+ years
> ago. Get the latest code from SubVersion instead of the ZIP download.
>
>
>
There's no question that the component needs an update as the current zip
on the Lazarus-ccr was packaged in 2006. SVN is more current and Graeme and
I will get together and roll any additional improvements he's made into a
new release.

If we need to make improvements to the core measurement routines for better
cross platform support, some additional input would be helpful. For
hardware timing, I see the following support across processor types:

http://en.wikipedia.org/wiki/Hardware_performance_counter

There is a Performance API (PAPI) standard for cross platform access to
those counters, but probably not a candidate as it requires OS support.
Regarding OS based timing, my experience is limited to Linux and Intel/AMD,
so if there's a more universal approach, I'd be very interested in learning
more about it.

Thanks,

-Tom
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] [Off Topic] Guys, you know the news?

2014-05-19 Thread silvioprog
2014-05-19 14:27 GMT-03:00 Junior :

> It seems that Brook was a stolen from another project.
>
> In https://groups.google.com/forum/?hl=pt-BR&fromgroups#!
> topic/lazarus-br/8FQND1qoAd8 (mailing list of the Silvio). There was a
> confusion about the project Brook Framework, and says the project that was
> stolen here:
>
> http://www.yanniel.info/2011/12/pascal-server-pages-script.html
>
> The Silvio just wants to be the best of all. It is the third time that he
> discusses in the list. Where does he think he will get?


This message (spam) is from the same author with dual identity, a.k.a
Robson.

I received insults in pvt. This is the famous "hue hue br br br" (
http://knowyourmeme.com/memes/huahuehuahue). Therefore,
Robson/Lazarus.linux/Junior.linux/others is just a flamer, who that
delights causing flames/trolls in Delphi/Lazarus/Linux lists.

-- 
Silvio Clécio
My public projects - github.com/silvioprog
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Graeme Geldenhuys
On 2014-05-19 11:03, Michael Schnell wrote:
> Obviously I can't _use_ EpricTimer there, as it uses (IMHO 
> inappropriately) (graphics-) stuff that is not implemented in a non-GUI 
> project.

You are clearly using a very outdated version. That was fixed 2+ years
ago. Get the latest code from SubVersion instead of the ZIP download.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] [Off Topic] Guys, you know the news?

2014-05-19 Thread Junior

It seems that Brook was a stolen from another project.

In 
https://groups.google.com/forum/?hl=pt-BR&fromgroups#!topic/lazarus-br/8FQND1qoAd8 
(mailing list of the Silvio). There was a confusion about the project 
Brook Framework, and says the project that was stolen here:


http://www.yanniel.info/2011/12/pascal-server-pages-script.html

The Silvio just wants to be the best of all. It is the third time that 
he discusses in the list. Where does he think he will get?


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Fpcup problem with Lazarus

2014-05-19 Thread Reinier Olislagers
On 19/05/2014 14:11, Koenraad Lelong wrote:
> ### TCodeToolManager.HandleException: "unit not found: Classes" at
> Line=26 Col=10 in "/home/koenraad/development/lazarus/lcl/lclclasses.pp"
> TDesigner.InvokeComponentEditor ERROR: Unable to find method. Please fix
> the error shown in the message window, which is normally below the
> source editor.
> In the lazarus-IDE I also get an error-message, stating the same.
> 
> I'm running linux. My lazarus is at svn rev. 45085.
> 
> What's wrong ?

http://wiki.lazarus.freepascal.org/fpcup#Error_finding_.28e.g..29_system.ppu_when_compiling_with_FPC.2FLazarus


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Fpcup problem with Lazarus

2014-05-19 Thread Koenraad Lelong

Hi,

I tried fpcup to get a "user" version of lazarus. With that I mean a 
version of lazarus where adding packages is more easy than with a 
packaged version of lazarus.

But I'm exeriencing a problem.
I ran fpcup and all seems OK, but when I make a simple project, form 
with a button, I can't double click on the button to give it an 
OnClick-event. I get an error (on the commandline) :

TDesigner.InvokeComponentEditor A Button1:TButton
TDesigner.InvokeComponentEditor B TDefaultComponentEditor
### TCodeToolManager.HandleException: "unit not found: Classes" at 
Line=26 Col=10 in "/home/koenraad/development/lazarus/lcl/lclclasses.pp"
TDesigner.InvokeComponentEditor ERROR: Unable to find method. Please fix 
the error shown in the message window, which is normally below the 
source editor.

In the lazarus-IDE I also get an error-message, stating the same.

I'm running linux. My lazarus is at svn rev. 45085.

What's wrong ?

Koenraad

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Michael Schnell

On 05/19/2014 10:19 AM, Michael Schnell wrote:



I obviously would like to use an improved version of EpricTimer there ...


Obviously I can't _use_ EpricTimer there, as it uses (IMHO 
inappropriately) (graphics-) stuff that is not implemented in a non-GUI 
project. So I will need to extract some of the source code.


-Michael


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Michael Schnell

On 05/19/2014 11:02 AM, Michael Van Canneyt wrote:


.
function HardwareTicks: TickType; assembler; asm DW 0310FH end;


OK. Found it.

Lets see how to do something arch independent

-Michael

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Michael Van Canneyt



On Mon, 19 May 2014, Michael Schnell wrote:


On 05/19/2014 10:19 AM, Michael Van Canneyt wrote:



The register is already used for tick counts.

Please let me know where.

For TTimer in AvtiveNoGu I now use TThread.GetTickCount64 (or 
SysUtils.GetTickCount64)-


I did ASM stepping into same and it does a syscall. (Linux X86/32)


Line 362 of epiktimer or thereabouts.

// Execute the Pentium's RDTSC instruction to access the counter value.
function HardwareTicks: TickType; assembler; asm DW 0310FH end;

Obviously only used if you get hardware ticks, not system ticks.
(for the latter obviously a system call is done)

Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Michael Van Canneyt



On Mon, 19 May 2014, Reinier Olislagers wrote:


On 18/05/2014 09:08, Michael Van Canneyt wrote:

On Sat, 17 May 2014, Tom Lisjac wrote:

No mystery here either. You never miss an opportunity to criticize
EpikTimer for reasons I've never been able to understand.


Nevertheless, I have named the reasons explicitly every time.

It is simply frustrating to see that people ask for something
cross-platform, *better than Now()*
for timing, and then epiktimer is recommended. Never fails.


I suspect because epiktimer has better PR/visibility than the native FPC
alternatives.
Why not update the EpikTimer page with information regarding the
alternatives?


I'm hoping that the epiktimer implementation will be improved.

Meanwhile, enough suggestions on how to improve the implementation 
have been made.


Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Michael Schnell

On 05/19/2014 10:19 AM, Michael Van Canneyt wrote:



The register is already used for tick counts.

Please let me know where.

For TTimer in AvtiveNoGu I now use TThread.GetTickCount64 (or 
SysUtils.GetTickCount64)-


I did ASM stepping into same and it does a syscall. (Linux X86/32)

-Michael

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Reinier Olislagers
On 18/05/2014 09:08, Michael Van Canneyt wrote:
> On Sat, 17 May 2014, Tom Lisjac wrote:
>> No mystery here either. You never miss an opportunity to criticize
>> EpikTimer for reasons I've never been able to understand.
> 
> Nevertheless, I have named the reasons explicitly every time.
> 
> It is simply frustrating to see that people ask for something
> cross-platform, *better than Now()*
> for timing, and then epiktimer is recommended. Never fails.

I suspect because epiktimer has better PR/visibility than the native FPC
alternatives.
Why not update the EpikTimer page with information regarding the
alternatives?


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Attn Mattias: is r45063 correct? Fixed building lhelp under FPC 2.6.4

2014-05-19 Thread Mattias Gaertner
On Mon, 19 May 2014 10:21:44 +0200
Reinier Olislagers  wrote:

> Saw this
> r45063
> lhelp: fixed building lhelp under fpc 2.6.4
> 
> ---
> branches/fixes_1_2/components/chmhelp/packages/idehelp/lazchmhelp.pas
> 2014/05/17 18:55:25   45062
> +++
> branches/fixes_1_2/components/chmhelp/packages/idehelp/lazchmhelp.pas
> 2014/05/17 18:57:08   45063
> @@ -283,6 +283,9 @@
>//  Exit;
> 
>Proc := TProcessUTF8.Create(nil);
> +  {$if FPC_FULLVERSION<20400}
> +  Proc.InheritHandles := false;
> +  {$endif}
>{$if (fpc_version=2) and (fpc_release<5)}
>Proc.CommandLine := Lazbuild+' '+WS+' '+PCP+' '+LHelpProject;
>{$else}
> 
> However, that tests for FPC up to and including FPC 2.3, not 2.6.4 and up
> Either:
> 1. the description of the fix is wrong
> 2. the fix is wrong
> 3. I haven't had enough coffee or there's something else wrong with me...

You are right. It should be 20604. Fixed.

Mattias

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Attn Mattias: is r45063 correct? Fixed building lhelp under FPC 2.6.4

2014-05-19 Thread Reinier Olislagers
Saw this
r45063
lhelp: fixed building lhelp under fpc 2.6.4

---
branches/fixes_1_2/components/chmhelp/packages/idehelp/lazchmhelp.pas
2014/05/17 18:55:25 45062
+++
branches/fixes_1_2/components/chmhelp/packages/idehelp/lazchmhelp.pas
2014/05/17 18:57:08 45063
@@ -283,6 +283,9 @@
   //  Exit;

   Proc := TProcessUTF8.Create(nil);
+  {$if FPC_FULLVERSION<20400}
+  Proc.InheritHandles := false;
+  {$endif}
   {$if (fpc_version=2) and (fpc_release<5)}
   Proc.CommandLine := Lazbuild+' '+WS+' '+PCP+' '+LHelpProject;
   {$else}

However, that tests for FPC up to and including FPC 2.3, not 2.6.4 and up
Either:
1. the description of the fix is wrong
2. the fix is wrong
3. I haven't had enough coffee or there's something else wrong with me...

Thanks,
Reinier

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Michael Schnell

On 05/19/2014 10:19 AM, Michael Van Canneyt wrote:



But I am eagerly awaiting your vDSO implementation.


Still hoping for Tom ...

But if EpicTimer is not improved I might be willing to test this for 
ActiveNoGui.


-Michael

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Michael Schnell

On 05/19/2014 09:49 AM, Michael Van Canneyt wrote:


If the result of my continued hammering is that now someone will 
actually contribute

improvements,

Similar as with ActiveNoGui :-) :-) :-) .

I obviously would like to use an improved version of EpricTimer there as 
a  very handy in cross-platform unified

timing interface for TTimer.

-Michael

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Michael Van Canneyt



On Mon, 19 May 2014, Michael Schnell wrote:


On 05/18/2014 09:08 AM, Michael Van Canneyt wrote:



Your component is probably perfectly suited for Intel 32-bit. 


(At least) For Linux I doubt this. vDSO or even direct access to the CPU 
register (if really possible) seem more appropriate than doing a syscall..


The register is already used for tick counts.

But I am eagerly awaiting your vDSO implementation.

Michael.


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Michael Schnell

On 05/18/2014 09:08 AM, Michael Van Canneyt wrote:



Your component is probably perfectly suited for Intel 32-bit. 


(At least) For Linux I doubt this. vDSO or even direct access to the CPU 
register (if really possible) seem more appropriate than doing a syscall..


I suppose a version of EpicTimer that does what is the best possible way 
for all Archs and OSes supported by fpc is a lot of work, hard to be 
tested and a moving target. But a viable project anyway.


-Michael

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Michael Schnell

On 05/18/2014 08:10 PM, Graeme Geldenhuys wrote:

{$IFDEF Windows}
begin
   QueryPerformanceCounter(Result);

Did you check that this is a low overhead function ?

{$ELSE}
do_syscall(syscall_nr_clock_gettime,TSysParam(CLOCK_MONOTONIC),TSysParam(@ts))

It seems that a syscall is not necessary with some / many environments.

vDSO seems to provide a user-land implementation in (many) current 
Kernel versions.


Maybe directly accessing the appropriate CPU registers is possible / 
viable in some architectures


-Michael

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Michael Schnell

On 05/18/2014 08:10 PM, Graeme Geldenhuys wrote:


And that is exactly what my local copy of EpikTimer does for over a year
alread - just one of many improvements I've made to my copy of
EpikTimer, but sadly never got around to sharing the code (which I'll do
shortly).

Thanks a lot !

If the code is decently tested and documented, and available for all 
supported platforms and OSes, I vote for adding it to the RTL


-Michael

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] [ANN] Brook 3.0.0 release!

2014-05-19 Thread Michael Van Canneyt



On Sun, 18 May 2014, silvioprog wrote:


  http://leonardorame.blogspot.com


Hello Leonardo,

I'm flattered with your comment.

We can add a new file, called "WHATS_NEW.txt", and it can be rewritten in all new 
versions, showing "what's new" in this released
version.

What do you think of this idea?


Go for it !

Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] How to program with time in milliseconds?

2014-05-19 Thread Michael Van Canneyt



On Sun, 18 May 2014, Graeme Geldenhuys wrote:


On 2014-05-18 00:49, Tom Lisjac wrote:

I'm adding some clarification and context to your ongoing comments about
EpikTimer in this and other threads.


What Michael also keeps forgetting, is that EpikTimer gives a unified
timing interface, which is very handy in cross-platform applications.
Yes we could manually use QueryPerformanceCounter under Windows,
clock_gettime() under Linux and FreeBSD, and fpgettimeofday() everywhere
else but EpikTimer gives us a clean API to use, and takes care of
the platform differences for us. Makes for much cleaner code in our
applications, which I personally think is nice!


I have never tried to suggest that a component as epiktimer does not fill a gap.

Once more, the only issue I am having is the continued suggestion that it is better and 
offers more fine-grained/accurate timing than simply using now() when going cross-platform.


If the result of my continued hammering is that now someone will actually 
contribute
improvements, I can only appreciate the effort and you won't hear me about it 
ever again.

Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus