\r\n

51Degrees Device Detection Python  4.4

Device Detection services for 51Degrees Pipeline

fiftyone_devicedetection_examples.onpremise.performance Namespace Reference

def  process_user_agent (user_agent)
def  process_user_agent_list (data_file, user_agent_list, list_number, output, skip=False)
def  run (data_file, skip=False)
 ap = argparse.ArgumentParser(description='Run detection benchmark.')
 default  help  args = ap.parse_args()  data_file  user_agents_file  newline  reader = csv.reader(file)  user_agents = list(reader)  number_of_user_agents = len(user_agents)  threads = mp.cpu_count()  chunk_size = int(number_of_user_agents / threads) list  split_lists def  calibration = run(args.data_file, skip=True) def  real = run(args.data_file, skip=False) def  real_time = real["time"] dictionary  results  file dictionary  final_result

Function Documentation

◆ process_user_agent()

def fiftyone_devicedetection_examples.onpremise.performance.process_user_agent (   user_agent )

◆ process_user_agent_list()

def fiftyone_devicedetection_examples.onpremise.performance.process_user_agent_list (   data_file,
  user_agent_list,
  list_number,
  output,
  skip = False  
)

◆ run()

def fiftyone_devicedetection_examples.onpremise.performance.run (   data_file,
  skip = False  
)

Variable Documentation

◆ ap

fiftyone_devicedetection_examples.onpremise.performance.ap = argparse.ArgumentParser(description='Run detection benchmark.')

◆ args

fiftyone_devicedetection_examples.onpremise.performance.args = ap.parse_args()

◆ calibration

def fiftyone_devicedetection_examples.onpremise.performance.calibration = run(args.data_file, skip=True)

◆ chunk_size

fiftyone_devicedetection_examples.onpremise.performance.chunk_size = int(number_of_user_agents / threads)

◆ data_file

fiftyone_devicedetection_examples.onpremise.performance.data_file

◆ default

fiftyone_devicedetection_examples.onpremise.performance.default

◆ file

fiftyone_devicedetection_examples.onpremise.performance.file

◆ final_result

dictionary fiftyone_devicedetection_examples.onpremise.performance.final_result
Initial value:
1 = {
2  "mobile": 0,
3  "notmobile": 0,
4  "unknown": 0
5  }

◆ help

fiftyone_devicedetection_examples.onpremise.performance.help

◆ newline

fiftyone_devicedetection_examples.onpremise.performance.newline

◆ number_of_user_agents

fiftyone_devicedetection_examples.onpremise.performance.number_of_user_agents = len(user_agents)

◆ reader

fiftyone_devicedetection_examples.onpremise.performance.reader = csv.reader(file)

◆ real

def fiftyone_devicedetection_examples.onpremise.performance.real = run(args.data_file, skip=False)

◆ real_time

def fiftyone_devicedetection_examples.onpremise.performance.real_time = real["time"]

◆ results

dictionary fiftyone_devicedetection_examples.onpremise.performance.results
Initial value:
1 = {
2  "DetectionsPerSecond": 1.0 / (real_time / number_of_user_agents),
3  "MsPerDetection": real_time * 1000 / number_of_user_agents
4  }

◆ split_lists

list fiftyone_devicedetection_examples.onpremise.performance.split_lists
Initial value:
1 = [user_agents[x:x+chunk_size]
2  for x in range(0, len(user_agents), chunk_size)]

◆ threads

fiftyone_devicedetection_examples.onpremise.performance.threads = mp.cpu_count()

◆ user_agents

fiftyone_devicedetection_examples.onpremise.performance.user_agents = list(reader)

◆ user_agents_file

fiftyone_devicedetection_examples.onpremise.performance.user_agents_file
On This Page