Get Started

Timing

Job Timing for Dirac-1 and Dirac-2

When a job is run on a Dirac-1 or Dirac-2 QPU, various types of timing information are included in the response object within job_info['metrics'].
Dirac-1 job timing
Below we show some examples of the types of timing information that are contained in the job response for a problem run on Dirac-1.
123456789101112131415161718192021222324252627282930
time_precision = 4  # number of decimal places for time values (seconds)
ns = 1e9            # number of nanoseconds per second

# the total time it took for the job to complete after it was submitted
# (includes queue time and run time)
qatalyst_total_job_time_ns = response['job_info']['metrics']['time_ns']['wall']['total']
print(f"Qatalyst total job time: {round(qatalyst_total_job_time_ns / ns, time_precision)}s ")

# the total amount of time that the job spent in queue waiting to run
qatalyst_total_queue_time_ns = response['job_info']['metrics']['time_ns']['wall']['queue']['total']
print(f"Qatalyst total queue time: {round(qatalyst_total_queue_time_ns / ns, time_precision)}s ")

sampler_type = response['job_info']['submission']['params']['sampler_type']
if sampler_type == "eqc1":
    device = "dirac_1"
    provider_name = "qphoton"
    device_name = f"{device}_device"
    controller_name = f"{device}_controller"
    # Total time for the job inside the QPU subsystem
    qpu_total_time_ns = response['job_info']['metrics']['provider'][provider_name]['time_ns']['wall']['total']
    print(f"QPU total time: {round(qpu_total_time_ns / ns, time_precision)}s ")

    # Processing time for the job inside the QPU subsystem
    qpu_processing_time_ns = response['job_info']['metrics']['provider'][provider_name]['time_ns']['wall']['processing']['total']
    print(f"QPU processing time: {round(qpu_processing_time_ns / ns, time_precision)}s")

    # Total queue time within the QPU subsystem
    qpu_queue_time_ns = response['job_info']['metrics']['provider'][provider_name]['time_ns']['wall']['queue']['total']
    print(f"QPU queue time: {round(qpu_queue_time_ns / ns, time_precision)}s ")
Sample output:
12345
Qatalyst total job time: 71.2155s 
Qatalyst total queue time: 0.1134s 
QPU total time: 65.3129s 
QPU processing time: 64.9617s
QPU queue time: 0.0169s 
Dirac-2 job timing
Similar code may be used to obtain timing information for jobs run on Dirac-2. Simply substitute
123
if sampler_type == "eqc2":
    device = "dirac_2"
    ...
in the code above to print timing information for Dirac-2 jobs.
CSample job timing
When a job is run using CSample, timing information is also included in the response object within job_info['metrics'], using a slightly different format. Below we show some examples of the types of timing information that are contained in the job response for jobs run using CSample:
1234567891011121314
sampler_type = response['job_info']['submission']['params']['sampler_type']
if sampler_type == "csample":
    device = "csample"

    csample_total_time_ns = response['job_info']['metrics']['time_ns']['wall']['total']
    csample_queue_time_ns = response['job_info']['metrics']['time_ns']['wall']['queue']['total']
    csample_sampler_queue_time_ns = response['job_info']['metrics']['time_ns']['wall']['queue']['sampler']['total']

    print(f"CSample total time: {round(csample_total_time_ns / ns, time_precision)}s ")
    print(f"CSample queue time: {round(csample_queue_time_ns / ns, time_precision)}s ")

    csample_run_time_ns = csample_total_time_ns - csample_queue_time_ns

    print(f"CSample run time (calculated): {round(csample_run_time_ns / ns, time_precision)}s ")
Sample Output:
12345
Qatalyst total job time: 260.5626s 
Qatalyst total queue time: 252.1678s 
CSample total time: 260.5626s 
CSample queue time: 252.1678s 
CSample run time (calculated): 8.3948s 

Contents