| Click here to select a new forum. |
| Getting CPU Speed Using the Gestalt Manager |
Posted by: Phipli on 2026-01-03 17:03:53 Well, I'm confused.
I've been trying to get the CPU speed from the Gestalt Manager, as it says in the title. I'm using CodeWarrior Pro 4 on an emulated Quadra 800 running Mac OS 8.1.
I have code similar to the following :
#include <stdio.h>
#include <Gestalt.h>
#include <Errors.h>
int main(void) {
long procSpd;
OSErr err;
err = Gestalt('Frq2', &procSpd);
if (err != noErr){
printf("Gestalt Error %d\n", err);
}else{
printf("Gestalt returned %d\n", procSpd);
}
return 0;
}
I get a gestalt error -5551, but it has to be available! This is from the same (emulated) machine :

If I replace 'Frq2' with something like 'proc', everything works as expected.
Note that 'Frq2' doesn't have an entry in the gestalt.h file that comes with CodeWarrior - does this mean that it is also missing from a library and that is causing my issue? Because I'm on an 040, I don't seem to have access to 'Freq', 'pclk' or anything else that might be helpful, but obviously Gestalt.Appl is managing it somehow 🙁 |
Posted by: cheesestraws on 2026-01-03 17:28:51
but obviously Gestalt.Appl is managing it somehow 🙁
Look at the text box at the bottom: it says it's a pseudo-selector, which means it's synthesising it from other Gestalt data. |
Posted by: David Cook on 2026-01-03 17:31:17 I think the 'More information' tab (lower right of your screenshot) explains that it is redirecting this call from pclk. |
Posted by: David Cook on 2026-01-03 17:31:49
Look at the text box at the bottom: it says it's a pseudo-selector, which means it's synthesising it from other Gestalt data.
@cheesestraws was quicker to the draw. |
Posted by: cheesestraws on 2026-01-03 17:35:24
I think the 'More information' tab (lower right of your screenshot) explains that it is redirecting this call from pclk.
No pclk for me on an 040 either; it seems to make a wild guess based on some magic involving the contents of the kFrq resource. Too tired to take it to bits to work out exactly what. |
Posted by: Phipli on 2026-01-03 17:35:27
I think the 'More information' tab (lower right of your screenshot) explains that it is redirecting this call from pclk. pclk isn't implemented on the Quadra 800, it's a PPC thing (possibly also the 840av... Not sure). |
Posted by: Phipli on 2026-01-03 17:39:20
Look at the text box at the bottom: it says it's a pseudo-selector, which means it's synthesising it from other Gestalt data. OK, so it is something implemented in this program specifically?
I assume the application must also come with libraries or something. I thought it was for reference. I'll have to do some digging in the morning. It's been bugging me that loads of software clearly gets a value from somewhere in the OS which is set during boot, because if you, cough, dynamically change the clock, they all still report the boot speed, unless you restart at the new speed. |
Posted by: Phipli on 2026-01-03 17:41:54
kFrq resource This looks interesting - will research tomorrow. Cheers. Not heard of it before. |
Posted by: cheesestraws on 2026-01-03 17:42:16
OK, so it is something implemented in this program specifically?
Yes. Specifically, I assume, in the AffichFrq2 function in 'CODE' 4. Which looks like a bit of a mess, if I'm being honest... |
Posted by: cheesestraws on 2026-01-03 17:42:52
This looks interesting - will research tomorrow. Cheers. Not heard of it before.
I mean in the application, sorry. This isn't some neat system-level facility. |
| 1 |