def load_cpu_json(request, rd): response = HttpResponse(content_type="application/json") cpu = rd.cpu_profile json_serialize(response, "cpu {filename} {runtime_id}", filename=cpu.file, runtime_id=cpu.cpuprofile_id) return response
def meta(request, profile): jl = _load_jitlog_model(request, profile) response = HttpResponse(content_type="application/json") json_serialize(response, "meta {filename} {profile}", filename=jl.file.path, profile=profile) return response
def load_memory_json(request, rd, start, end): response = HttpResponse(content_type="application/json") cpu = rd.cpu_profile json_serialize(response, "mem {filename} {runtime_id} {start} {stop}", filename=cpu.file, runtime_id=cpu.cpuprofile_id, start=start, stop=end) return response
def stitches(request, profile): jl = _load_jitlog_model(request, profile) if 'id' not in request.GET: raise Http404("mandatory GET parameter 'id' missing") uid = int(request.GET['id']) response = HttpResponse(content_type="application/json") json_serialize(response, "stitch {filename} {profile} {uid}", filename=jl.file.path, profile=profile, uid=uid) return response
def extract_meta(rd): cpu = rd.cpu_profile strio = io.StringIO() json_serialize(strio, "metacpu {filename} {runtime_id}", filename=cpu.file, runtime_id=cpu.cpuprofile_id) strio.seek(0) jsondata = json.loads(strio.read()) if 'error' in jsondata: raise ValidationError(jsondata['error']) start_time = jsondata.get('start_time', None) if start_time: rd.start_time = datetime.datetime.strptime(start_time, STRFTIME_FMT) end_time = jsondata.get('end_time', None) if end_time: rd.stop_time = datetime.datetime.strptime(end_time, STRFTIME_FMT) rd.arch = jsondata.get('arch', 'unknown') rd.os = jsondata.get('os', 'unknown') rd.save()