how to calculate clock cycle of an instruction

Remember that counting clock cycles is only appropriate for assembly language (or machine code). C/C++ code varies on how it is transformed into machine code, depending upon which compiler, compiler options and version of the compiler are used.