Recent

Author Topic: System information  (Read 5456 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
System information
« on: March 18, 2010, 04:43:21 pm »
So I want to know how to retrieve the following information:

1: Simensioni Hard Disk
2: RAM capacity
2: CPU capacity

You know how you can do natively? Thank you
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

A

  • Guest
Re: System information
« Reply #1 on: January 07, 2018, 01:12:16 pm »
I wouldn't normally grave-dig, but you have a tonne of posts, so I'd guess you're still active. If you're not, then someone might find this quite useful in the future (including myself).

From searching online, I don't think Pascal has any libraries that retrieve system information. I know that other, more documented languages do, however, the libraries differ depending upon which operating system is being used.

From a person who is very new to programming, I can only offer you a common-sense approach, with no actual code, because I don't know how.

For Linux, perhaps you could run the "lshw" command in the background to retrieve information about memory, CPU etc. via the command line. For Windows, you could run the "systeminfo" command to accomplish the same thing. I don't know if you can directly capture the command line output, but you can certainly stream the output to a text file. You could then "read" the text file and selectively grab the data that you need from it.

This is quite a messy way of accomplishing what you need, however, aside from sudo authentication difficulties, it would likely get the job done.

eny

  • Hero Member
  • *****
  • Posts: 1634
Re: System information
« Reply #2 on: January 07, 2018, 09:41:09 pm »
I wouldn't normally grave-dig...
%)
All posts based on: Win10 (Win64); Lazarus 2.0.10 'stable' (x64) unless specified otherwise...

Kays

  • Hero Member
  • *****
  • Posts: 575
  • Whasup!?
    • KaiBurghardt.de
Re: System information
« Reply #3 on: January 07, 2018, 11:58:22 pm »
1: Simensioni Hard Disk
I don't know what you mean by “Simensioni”. Is it “Dimensions” in some Romanian language? Do you mean like “3 ½ inches”? Or like “42 sectors à 512B”? For latter I'd say in the Unix world, do a BaseUnix.fpStat() on the block device.

2: RAM capacity
Linux.SysInfo() is too specific to a specific OS, isn't it?

2: CPU capacity
What do you mean by “CPU capacity”? Just System.GetCPUCount() probably not, eh?

You know how you can do natively?
Depends on what you mean by “natively”.
Yours Sincerely
Kai Burghardt

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: System information
« Reply #4 on: January 08, 2018, 06:38:11 am »

 

TinyPortal © 2005-2018