Back in the 60's and 70's at the Chrysler Tech Center we used to do Octane Testing for all our production engines like this. We would bring in 5 gallons of gas of each octane from 80 to 102 using only the even numbers for actual testing into the dyno test cell. This was back when the dyno operator was in the cell right next to the engine. There were NO walls of any kind for protection. We would start the test at 800 rpm at WOT and go up in speed every 400 rpm till we got to 4800 rpm. While the dyno operator ran the dyno the engineer would plug in one of the cans of gas and advance the spark till he could hear the engine knocking. He would stand right next to the engine as close as possible to hear the initial pinging. Then he would unplug the gas can and plug in the next octane and repeat the procedure. Every time you would unplug the quick disconnect gas would splash out. By the time you got to 3200 rpm or so the exhaust manifolds would be red hot. It was truly amazing through all those years nobody got hurt or there were no fires or explosions. From 3200 rpm and on the sound of the engine was incredible. Of course we wore ear muffs for sound deadening but they didn't help much. Around the 1980's OSHA came in and said that will be enough of that and sound proof walls were built and the operator and the engineer were in another room. Around the late 70's we got Scopes and pressure transducers so we could actually see the detonation and the pressure spikes more safely. At the end of the test we had spark curves for each speed and octane and that's how they determined what the spark advance would be.A tool with data recording that is graph-able later on a laptop is useful for diagnosis. Watch ignition advance and the upstream O2 sensor (or fuel injector pulsewidth) for mixture.
The knock (piezo-electric) sensor should also generate a voltage under detonation that (should) retard spark advance.
Instead of buying an expensive tool, consider paying a shop diagnostic fee (usually the minimum charge of 1 hr) or borrow one (unless you really want the capability for your tool inventory).