old_contents: #!/usr/bin/env python
  from __future__ import division, print_function
  
  
  def metric(data, report, callid):
      """Performance the operations relative to peak.
  
      This is comparing the flops/cycle to the system's peak.
      """
      if callid is None:
          return None
      nops = data.get("complexity")
      rdtsc = data.get("rdtsc")
      call = report["calls"][callid]
      if nops is None or rdtsc is None or not hasattr(call, "sig"):
          return None
      sampler = report["sampler"]
      nt = report["nt"]
      datatype = call.sig.datatype()
      if "single" in datatype:
          ipc = sampler["sflops/cycle"]
      elif "double" in datatype:
          ipc = sampler["dflops/cycle"]
      else:
          return None
      return nops / (rdtsc * ipc * nt)
  
  name = "efficiency"
  
new_contents: #!/usr/bin/env python
  from __future__ import division, print_function
  
  
  def metric(data, report, callid):
      """Performance the operations relative to peak.
  
      This is comparing the flops/cycle to the system's peak.
      """
      nops = data.get("complexity")
      rdtsc = data.get("rdtsc")
      if nops is None or rdtsc is None:
          return None
  
      # get datatype
      calls = report["calls"]
      if callid is not None:
          calls = [report["calls"][callid]]
      if any(not hasattr(call, "sig") for call in calls):
          return None
      datatypes = set(call.sig.datatype() for call in calls)
      if len(datatypes) > 1:
          return None
      datatype = datatypes.pop()
  
      # get ipc
      sampler = report["sampler"]
      if "single" in datatypes:
          ipc = sampler["sflops/cycle"]
      elif "double" in datatype:
          ipc = sampler["dflops/cycle"]
      else:
          return None
  
      nt = report["nt"]
      return nops / (rdtsc * ipc * nt)
  
  name = "efficiency"
  
subject: allow more than 1 call in efficiency