Is there an way to know (print in serial) the number of power cycles? I mean, how many times device (photon, in this case) was reset?
If you want to count the resets, you can use
retained variables - see reference docs about Backup RAM
If you want to count the actual power-cycles (removing power completely), you need to use some non-volatile memory like EEPROM - also featured in the reference docs.
Yeah, I would say just increment a value in EEPROM for every program init!