Yes, the clock speed should be (and most probably is) 8 MHz. However, you're not generating an 8 MHz clock.
What you are in fact generating is 8 clock pulses of 8 MHz, then you have a delay while it deals with the rest of your code, and then it generates another 8 clock cycles of 8MHz.
The overall frequency is evidently sensed as 3.439 MHz.
To generate a pure 8 MHz clock you would have to use a different transfer method. I don't know if the 328P has DMA available, but if it does, that would give you much faster transfers. Also, you could write a more non-blocking version of SPI.transfer().
The normal SPI.transfer() first starts the transfer, then waits for the transfer to finish, and returns the results of the transfer. If you're only interested in transmitting, and not receiving, or the transmitted and received data don't need to c correlate completely, you can instead change the order of how it works:
- Wait for there to be no transfer in operation
- Store the result of the last transfer
- Start the new transfer
- Return the results of the last transfer.
That way it runs much smoother as it's doing the current transfer at the same time as running your other code.