I am not sure but I understand it this way. First you need to run "perf-object-start" and then "perf-object-stop" for specified duration(like 1 min). Then you need to run "perf-samples-get-iter" to get the sample details by giving the sample name, you saved with "perf-object-start" command. This is working for me for LIF object but for top_file I gets 0 records.
#starting "perf-object-start"
api = NaElement("perf-object-start")
api.child_add_string("duration","1")
api.child_add_string("max","5")
api.child_add_string("object","top_file")
api.child_add_string("sample-id","f")
xo = s.invoke_elem(api)
#stopping "perf-object"
api1 = NaElement("perf-object-stop")
api1.child_add_string("sample-id","f")
xo1 = s.invoke_elem(api1)
#Getting details for sample "f"
api = NaElement("perf-samples-get-iter")
xi = NaElement("query")
api.child_add(xi)
xi1 = NaElement("sample-info")
xi.child_add(xi1)
xi1.child_add_string("sample-id","f")
xo = s.invoke_elem(api)
if (xo.results_status() == "failed") :
print ("Error:\n")
print (xo.sprintf())
sys.exit (1)
print ("Received:\n")
print (xo.sprintf())