# Issues in calculating exact runtime on ibmq_16_melbourne

I am working on calculating the exact runtime of a quantum circuit on the ibmq_16_melbourne device. I am using the API result.time_taken to calculate the run time.

result = execute(circuit, backend, shots=8000).result()
counts = result.get_counts(circuit)
print(counts)
print("Time taken: ", result.time_taken)


I executed by python code on ibm quantum lab (which is a Jupyter notebook) and also using Pycharm on my laptop. I get huge variations in the results. So, I concluded that result.time_taken does not provide the run time correctly. I am going through the documentation, but still could not find the solution.

Please provide some solution to calculate exact runtime.

• Do you know if time_taken considers the queue time? If so, that probably makes up for the variations you are seeing. Jun 21 at 1:15
• No, time_taken doesnot include the queue time. Jun 21 at 3:10
• Jun 21 at 3:11
• @ManuChaudhary ok. You can do this theoretically. This might help: quantumcomputing.stackexchange.com/a/17304/9858 You can at least write a function that approximate the time your circuit takes per shot... then multiply that by however number of shots you used. If you use more than 8192 shots then you have to load another circuit, which has an overhead of about 15 seconds. Jun 21 at 4:17
• The measurement steps are the most expensive so you want to take that into account. The gate with the longest time is the CX gate... which ranges from 400 ns to 1000 ns. The RZ gate, which equivalent to U1 gate qiskit.org/documentation/stubs/… within an overall phase factor, is performed using a frame change so it is essentially free. See his paper: arxiv.org/pdf/1612.00858.pdf Jun 22 at 22:10