Re: Extension of systemVersion
Posted: Sun Sep 01, 2019 10:51 pm
Ahhhhhhh! Yes, then, it would be nice to get as much info as possible.
Questions and answers about the LiveCode platform.
https://forums.livecode.com/
Nope - in 9.5 the processor dictionary entry does (at least!) make it clear that you might get the emulated or host CPU. Of course it could say it in a clearer way, and suggest why this is the case in more detail!You have a function called the processor, which the dictionary blatantly states should be telling you what the CPU is. Instead, apparently, it tells you what your application is compiled for. You compiled the application, why would you need to know what you compiled it for? You already have this information before it leaves your machine.
Code: Select all
if the processor is "x86" then
-- look for x86 specific thing
end if
The problem I see with it occurs in several ways.bogs wrote: Sun Sep 01, 2019 6:44 am *Edit 3 - Also came across this interesting discussion about the processor function.
What ever you *might* get, you are never getting the actual processor, least not on straight up debian linux. This box is running a AMD 64 bit 3 core processor, on a (for this test) 64 bit Debian OS. At the least, since this is not in a virtual machine of any kind, I would expect the result to be
Code: Select all
bogs@bogsebian:~$ dpkg --print-architecture
amd64
bogs@bogsebian:~$ dpkg --print-foreign-architectures
i386
I'm sure that has been said by everyone going back to the beginning of time,LCMark wrote: Mon Sep 02, 2019 8:04 am the current functions we have are doing the right thing from the point of view of what is most commonly used (and actually needed).
but what is your view on "the machine"? If the processor is good enough, why shouldn't the machine report more information than it does, which is no more than the processor, *and* report it accurately (i.e. real hardware)?random historical figure wrote:[Technology] - Pump? Why on earth would you need a pump?? We have buckets, and that should be enough for anybody!![Speed] - As you may well know, Mr. President, ‘railroad’ carriages are pulled at the enormous speed of fifteen miles per hour by ‘engines’ which, in addition to endangering life and limb of passengers, roar and snort their way through the countryside, setting fire to crops, scaring the livestock and frightening women and children.
The Almighty certainly never intended that people should travel at such breakneck speed.[Computers] - 640k should be enough for anyone~! {Although that person now denies it was ever said by him}
In multi-arch setups, you can easily tell the base os with dpkg, and it does not require escalation (unless you are adding architectures). But simply reading the architecture requires no special priviledge, i.e.LCMark wrote: Mon Sep 02, 2019 12:44 pm i.e. you can't easily tell (from the point of view of the 32-bit process) that you are running in a 64-bit OS
Code: Select all
bogs@bogsebian:~$ dpkg --print-architecture # base architecture...
amd64
bogs@bogsebian:~$ dpkg --print-foreign-architectures # additional architectures...
i386
{Part in bold is one unit, your already pulling the psuedo processor just fine}LCMark wrote: Mon Sep 02, 2019 12:44 pm Specifically I'm not sure how true the 'which really shouldn't be that hard to obtain' statement in 'psuedo processor (reported now) , real processor (which really shouldn't be that hard to obtain).' actually is...
Code: Select all
bogs@bogsebian:~$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 48 bits physical, 48 bits virtual
CPU(s): 3
On-line CPU(s) list: 0-2
Thread(s) per core: 1
Core(s) per socket: 3
Socket(s): 1
NUMA node(s): 1
Vendor ID: AuthenticAMD
CPU family: 16
Model: 5
Model name: AMD Athlon(tm) II X3 450 Processor
Stepping: 3
CPU MHz: 3200.000
CPU max MHz: 3200.0000
CPU min MHz: 800.0000
BogoMIPS: 6429.06
Virtualization: AMD-V
L1d cache: 64K
L1i cache: 64K
L2 cache: 512K
NUMA node0 CPU(s): 0-2
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt nodeid_msr hw_pstate vmmcall npt lbrv svm_lock nrip_save
Code: Select all
bogs@bogsebian:~$ lspci
00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD9x0/RX980 Host Bridge (rev 02)
00:02.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GFX port 0)
00:04.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GPP Port 0)
00:09.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890/RD9x0/RX980 PCI to PCI bridge (PCI Express GPP Port 4)
00:11.0 SATA controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode] (rev 40)
00:12.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:12.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:13.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:13.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 SMBus Controller (rev 42)
00:14.1 IDE interface: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 IDE Controller (rev 40)
00:14.2 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 Azalia (Intel HDA) (rev 40)
00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 LPC host controller (rev 40)
00:14.4 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 PCI to PCI Bridge (rev 40)
00:14.5 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI2 Controller
00:16.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
00:16.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor HyperTransport Configuration
00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor Address Map
00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor DRAM Controller
00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor Miscellaneous Control
00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 10h Processor Link Control
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Oland PRO [Radeon R7 240/340]
01:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde/Pitcairn HDMI Audio [Radeon HD 7700/7800 Series]
02:00.0 USB controller: VIA Technologies, Inc. VL805 USB 3.0 Host Controller (rev 01)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)
04:07.0 Ethernet controller: Accton Technology Corporation SMC2-1211TX (rev 10)
bogs@bogsebian:~$
I think I wasn't clear enough, this pertains to the real processor, you will get the real processor no matter which program processes are being used (the psuedo hw).LCMark wrote: Mon Sep 02, 2019 1:47 pm ight but the above are presumably running a on a 64-bit debian environment... So that is a 64-bit terminal, calling a 64-bit lscpu
As I said, your already doing the psuedo one just fine, why change that? This would be an extension of what is already there.LCMark wrote: Mon Sep 02, 2019 1:47 pm Now you need to consider that you are running a 32-bit process on that 64-bit environment and, moreover, you want a way to determine the host processor which will work universally on any Linux distribution.
I missed this paragraph in the above...However, I know how smart you all are, and I know from the diverse group that works on such things that you already know both of these, so I just assume that there is some reason that these are not acceptable sources.
Case in point - last time I checked 'dpkg' is entirely Debian specific is it not?The actual proc files are what I usually target (like when your writing a top program), but for something of this level it isn't really needed. I agree a nice C api would be great, but I don't think your going to get 800+ distros to agree on that one, and besides, proc files / lscpu / dpkg have been around forever and aren't likely to disappear anytime soon.
I haven't delved through the code for the entire IDE, so there are lots of parts of this puzzle I am not knowledgeable about. Heck, I haven't even finished completely documenting the Mc IDE I work in regularly yet, keep in mind I have been playing some (20 ?) years of catch up in a lot of this stuffLCMark wrote: Mon Sep 02, 2019 2:21 pm The main question to ask here - why does it make sense for there to be engine syntax for it?
Every OS I've ever used has had this information, generally in great detail. On the other side of that, I haven't used *every* OS either. It is (usually) fairly easy to access if you know the magic incantations and which specific places to look, something that might take years of your life to figure out, or you could just ask your local nerd I suppose, but once you know where and how, it doesn't seem to change a whole lot in format even between OS'es....for things like the list of pci devices? Detailed information about CPUs? These things vary widely...
Is it standardized, yes.is the lscpu output standardized in any way and never going to change in format?
Good point, dpkg is only on Debian (and based) distros. However, the proc files are not that bad to figure out and are as far as I know across all systems. I'll check the standardization of the two wrapper calls.LCMark wrote: Mon Sep 02, 2019 2:24 pmCase in point - last time I checked 'dpkg' is entirely Debian specific is it not?The actual proc files are what I usually target (like when your writing a top program), but for something of this level it isn't really needed. I agree a nice C api would be great, but I don't think your going to get 800+ distros to agree on that one, and besides, proc files / lscpu / dpkg have been around forever and aren't likely to disappear anytime soon.
[ /proc is of course provided by the kernel - so that is at least as stable as Linus decides to make it - its just not quite as easy to grok as a well-defined, standardized syscall/libc API that's all! ]
Except for a handful of cases (most url related syntax for example) all engine syntax (properties, chunks etc.) and functions which have a 'the' form (e.g. the processor/machine/systemVersion) are all in the engine.If all functions are hard written into the engine(s), then it might be harder to justify for edge cases like the ones I mentioned.
Well here is the point of contention - 'the machine' is defined to return then result of 'uname' on Linux - that is it. Just because it is called 'the machine' it doesn't mean it necessarily returns anything concretely related to a physical machineHowever, since the machine is as I understand it at this point supposed to be telling you the real cpu, and it doesn't in certain cases, doesn't that mean it has to be fixed in the engine? If your already in there mucking about, that would seem an ideal time to think about whether this should be added or not. Providence!
Things which are standardized in the truest sense of the word (as related to computing) don't change - they expand, but what I mean here is that if you ran code compiled now on a system which conformed to standard X then would it still run the same way in a few years?Is it never going to change? How could you say? Everything changes at some point, even the programming language of this very topic. If anything, I would probably expect those two files to change in format. Even the proc files have changed in format.
Thanks for the insight <tucking away a note>LCMark wrote: Mon Sep 02, 2019 3:45 pmExcept for a handful of cases (most url related syntax for example) all engine syntax (properties, chunks etc.) and functions which have a 'the' form (e.g. the processor/machine/systemVersion) are all in the engine.If all functions are hard written into the engine(s), then it might be harder to justify for edge cases like the ones I mentioned.
Well, again the dictionary is a tad contradictory in the description, I wasn't going solely by the name of the function.Well here is the point of contention - 'the machine' is defined to return then result of 'uname' on Linux - that is it. Just because it is called 'the machine' it doesn't mean it necessarily returns anything concretely related to a physical machineHowever, since the machine is as I understand it at this point supposed to be telling you the real cpu, and it doesn't in certain cases, doesn't that mean it has to be fixed in the engine? If your already in there mucking about, that would seem an ideal time to think about whether this should be added or not. Providence!![]()
If you were shooting for the actual hardware, which is how I interpreted it, uname would be the last thing I would use. If, on the other hand, it is just going to return the same thing as processor, what is the point to having it?machine
Type function
Syntax
the machine
machine()
Summary
Returns the type of hardware the application is running on.
<sic>
Description
Use the machine function to detect what type of system your
application is running on.
In that context, then I still would dump uname and go to the proc files, at least for machine, even in the current limited form it is now.Things which are standardized in the truest sense of the word (as related to computing) don't change - they expand, but what I mean here is that if you ran code compiled now on a system which conformed to standard X then would it still run the same way in a few years?