How does cid make power?

Answer: you don’t.
Correct!
Here’s one for you…

How does one measure torque with the piston moving?
A machine … dyno. How the machine works specifically, exactly, I do not know. Or was the answer your looking for a bit deeper/earlier in history?