[fpc-pascal] Best practice for getting heap usage summary

2012-01-19 Thread Mark Morgan Lloyd
What is considered "best practice" for getting a summary of heap usage, 
in a single-threaded program which doesn't need to be Delphi-compatible?


In Delphi programs that have had to run for an extended period I've used 
 AllocMemCOunt() and AllocMemSize(). What's the best way of getting 
something comparable for FPC- THeapStatus.TotalAllocated etc.?


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Best practice for getting heap usage summary

2012-01-19 Thread Mattias Gaertner
On Thu, 19 Jan 2012 09:06:46 +
Mark Morgan Lloyd  wrote:

> What is considered "best practice" for getting a summary of heap usage, 
> in a single-threaded program which doesn't need to be Delphi-compatible?
> 
> In Delphi programs that have had to run for an extended period I've used 
>   AllocMemCOunt() and AllocMemSize(). What's the best way of getting 
> something comparable for FPC- THeapStatus.TotalAllocated etc.?

Maybe you mean GetFPCHeapStatus

http://lazarus-ccr.sourceforge.net/docs/rtl/system/getfpcheapstatus.html

There is also the Delphi compatible GetHeapStatus, but only for 32bit.

Mattias
 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] IPTables log parser?

2012-01-19 Thread Reinier Olislagers
Hi list,

I noticed ik has started a project to manipulate Linux iptables firewall
rules... which got me thinking.

Is there any FreePascal/Delphi code lying around to parse IPtables log
output (e.g. in the /var/log/messages syslog file), e.g. into CSV format?

If not, I'll probably write my own... sometime... as I'm interested in
importing the stuff into a database using my favourite tool.

Yes, I like reinventing the wheel but:
1. I could use existing suff, e.g. the dshieldpy python project,
dshield.py, parse function...
2. Reinventing wheels can be fun and a learning experience...

Thanks,
Reinier
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Best practice for getting heap usage summary

2012-01-19 Thread Mark Morgan Lloyd

Mattias Gaertner wrote:

On Thu, 19 Jan 2012 09:06:46 +
Mark Morgan Lloyd  wrote:

What is considered "best practice" for getting a summary of heap usage, 
in a single-threaded program which doesn't need to be Delphi-compatible?


In Delphi programs that have had to run for an extended period I've used 
  AllocMemCOunt() and AllocMemSize(). What's the best way of getting 
something comparable for FPC- THeapStatus.TotalAllocated etc.?


Maybe you mean GetFPCHeapStatus

http://lazarus-ccr.sourceforge.net/docs/rtl/system/getfpcheapstatus.html

There is also the Delphi compatible GetHeapStatus, but only for 32bit.


Yes, I was assuming that was necessary to get the THeapStatus block. I 
take it that you're confirming that this is the way to get the info, and 
that there aren't direct RTL calls.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] IPTables log parser?

2012-01-19 Thread ik
On Thu, Jan 19, 2012 at 11:37, Reinier Olislagers <
reinierolislag...@gmail.com> wrote:

> Hi list,
>
> I noticed ik has started a project to manipulate Linux iptables firewall
> rules... which got me thinking.
>
> Is there any FreePascal/Delphi code lying around to parse IPtables log
> output (e.g. in the /var/log/messages syslog file), e.g. into CSV format?
>

Not to my knowledge, but there are ways to get the content inside your
program in
realtime and do what you wish from it:
http://netfilter.org/projects/libnetfilter_log/index.html

If you willing in binding it, and add it to my project/


>
> If not, I'll probably write my own... sometime... as I'm interested in
> importing the stuff into a database using my favourite tool.
>
> Yes, I like reinventing the wheel but:
> 1. I could use existing suff, e.g. the dshieldpy python project,
> dshield.py, parse function...
> 2. Reinventing wheels can be fun and a learning experience...
>
> Thanks,
> Reinier
>

Ido

> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Best practice for getting heap usage summary

2012-01-19 Thread Jonas Maebe


On 19 Jan 2012, at 10:38, Mark Morgan Lloyd wrote:


Mattias Gaertner wrote:


Maybe you mean GetFPCHeapStatus
http://lazarus-ccr.sourceforge.net/docs/rtl/system/getfpcheapstatus.html
There is also the Delphi compatible GetHeapStatus, but only for  
32bit.


Yes, I was assuming that was necessary to get the THeapStatus block.  
I take it that you're confirming that this is the way to get the  
info, and that there aren't direct RTL calls.


The above is a direct RTL call. But note that
a) it is buggy in case of multi-threaded programs: 
http://bugs.freepascal.org/bug_view_advanced_page.php?bug_id=14315
b) it won't contain any information at all if you use cmem or another  
memory manager that does not keep track of allocation information.



Jonas___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] IPTables log parser?

2012-01-19 Thread Mark Morgan Lloyd

Reinier Olislagers wrote:

Hi list,

I noticed ik has started a project to manipulate Linux iptables firewall
rules... which got me thinking.

Is there any FreePascal/Delphi code lying around to parse IPtables log
output (e.g. in the /var/log/messages syslog file), e.g. into CSV format?


Not when I last looked, but that wasn't recent. I presume you're aware 
of logging via ulogd, which at least helps split things out a bit.


One marginally-related thing is visualising iptables' connection 
tracking using Doomcube, that could be improved enormously using an 
Elite-style display.


[Grumble] Command-line handling of iptables can be irritating since 
setting up a rule doesn't give you a unique tag you can use to delete 
it. I've had a situation in the past where I no longer knew the 
addresses etc. when it came to tearing a rule down, which caused problems.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] IPTables log parser?

2012-01-19 Thread Reinier Olislagers
On 19-1-2012 11:10, Mark Morgan Lloyd wrote:
> Reinier Olislagers wrote:
>> Hi list,
>>
>> I noticed ik has started a project to manipulate Linux iptables firewall
>> rules... which got me thinking.
>>
>> Is there any FreePascal/Delphi code lying around to parse IPtables log
>> output (e.g. in the /var/log/messages syslog file), e.g. into CSV format?
> 
> Not when I last looked, but that wasn't recent. I presume you're aware
> of logging via ulogd, which at least helps split things out a bit.

Thanks, both of you!

Yep, I'm aware of ulogd; however I prefer not installing stuff/tweaking
things on my router if I don't have to.

Didn't know about libnetfilter_log; I might indeed have a look at
libnetfilter_log to see if I can incorporate that into my FPC program.
If I do, I'll get back to you, Ido.

The alternative would be to parse the syslog output which I was thinking
about. Though it's not very pretty, the advantage of that is that I can
forward my router's syslog to another (database,... whatever) host and
run the extraction there...

Thanks,
Reinier
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] detect the version of fpc that a feature added to it

2012-01-19 Thread ik
Hello,

I was looking to understand in what version of FPC ($IF defined ... } was
added, and realized that it is not very simple to detect such information.
So beside this question of when was it added ?

What is the best way to find such information ?
Another question, should I open a bug for documentation, to add when a
specific feature like so was added in the documentation itself ?

Thanks,

Ido
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] detect the version of fpc that a feature added to it

2012-01-19 Thread Daniel Gaspary
On Thu, Jan 19, 2012 at 17:17, ik  wrote:
> Another question, should I open a bug for documentation, to add when a
> specific feature like so was added in the documentation itself ?

Do This issue cover this topic?

http://bugs.freepascal.org/view.php?id=15492
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] detect the version of fpc that a feature added to it

2012-01-19 Thread Marco van de Voort
In our previous episode, ik said:
> I was looking to understand in what version of FPC ($IF defined ... } was
> added, and realized that it is not very simple to detect such information.

True. SVN logs of documentation and compiler is the easiest. But that can be
exhausting. 

But $if is old. Wouldn't be surprised if the 2.x series all supported it.

In general I usually define the oldest version I want to support (now 2.4.4,
but from experience 2.4.2 usually works too), and dl and test with that
version (and intermediate ones).

Daniel: this is a language feature, the bugreport is about the same problem
for libraries.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to get path to current theme icons on linux?

2012-01-19 Thread cobines
2012/1/18 Krzysztof :
> Another problem. I know path to current icons, but icons are named
> like "office-spreadsheet" not by extension and can be in svg format :/

Read this:

http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html

There is a file "globs" that "contains a mapping from names to MIME types".

Therefore you can map for example "pdf" to "x-office-spreadsheet".

Look at sample code in function TPixMapManager.LoadMimeIconNames in

http://doublecmd.svn.sourceforge.net/viewvc/doublecmd/trunk/src/platform/upixmapmanager.pas

Once you have MIME name look here how to find the icon location in the
icon theme:

http://doublecmd.svn.sourceforge.net/viewvc/doublecmd/trunk/src/platform/uicontheme.pas

--
cobines
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal