test out profiling
@@ -0,0 +1,149 @@
|
||||
nconst,character,start,end
|
||||
nm0221046,Actor2,53000,237000
|
||||
nm0330687,Actor1,53000,237000
|
||||
nm0569501,Narrator,64000,237000
|
||||
nm0932891,Actor3,72000,237000
|
||||
nm3068638,Actor1 - Age 12,81000,237000
|
||||
nm2788212,Actor2 - Age 12,97000,237000
|
||||
nm1631269,Actor4,240000,424000
|
||||
nm0034309,Actor5,258000,424000
|
||||
nm1131557,Actor6,258000,424000
|
||||
nm0330687,Actor1,273000,424000
|
||||
nm0221046,Actor2,305000,424000
|
||||
nm0034309,Actor5,425000,558000
|
||||
nm0329622,Office Worker,427000,558000
|
||||
nm0330687,Actor1,427000,558000
|
||||
nm0932891,Actor3,427000,558000
|
||||
nm0381763,Actor7,433000,558000
|
||||
nm0803331,Usher,433000,558000
|
||||
nm0163988,Actor8,443000,558000
|
||||
nm0221046,Actor2,449000,558000
|
||||
nm0569501,Narrator,472000,558000
|
||||
nm0221046,Actor2,560000,647000
|
||||
nm0034309,Actor5,561000,647000
|
||||
nm0330687,Actor1,564000,647000
|
||||
nm0163988,Actor8,650000,813000
|
||||
nm0735538,Employee #1,650000,813000
|
||||
nm0330687,Actor1,652000,813000
|
||||
nm0006970,Actor9,654000,813000
|
||||
nm0803331,Usher,656000,813000
|
||||
nm0221046,Actor2,660000,813000
|
||||
nm0034309,Actor5,661000,813000
|
||||
nm0932891,Actor3,699000,813000
|
||||
nm0330687,Actor1,815000,1013000
|
||||
nm1131557,Actor6,815000,1013000
|
||||
nm0221046,Actor2,821000,1013000
|
||||
nm1631269,Actor4,865000,1013000
|
||||
nm0034309,Actor5,888000,1013000
|
||||
nm0034309,Actor5,1014000,1119000
|
||||
nm0330687,Actor1,1014000,1119000
|
||||
nm0221046,Actor2,1048000,1119000
|
||||
nm0330687,Actor1,1119000,1348000
|
||||
nm0034309,Actor5,1126000,1348000
|
||||
nm0221046,Actor2,1126000,1348000
|
||||
nm0006970,Actor9,1279000,1348000
|
||||
nm0330687,Actor1,1348000,1469000
|
||||
nm0221046,Actor2,1348000,1469000
|
||||
nm0034309,Actor5,1348000,1469000
|
||||
nm0221046/trivia,nt0447626,1377000,1469000
|
||||
nm0330687,Actor1,1470000,1619000
|
||||
nm0221046,Actor2,1471000,1619000
|
||||
nm1131557,Actor6,1547000,1619000
|
||||
nm0330687,Actor1,1622000,1839000
|
||||
nm0221046,Actor2,1627000,1839000
|
||||
nm2124215,Actor10,1752000,1839000
|
||||
nm0330687,Actor1,1839000,2006000
|
||||
nm0221046,Actor2,1839000,2006000
|
||||
nm0000148,Self,1910000,2006000
|
||||
nm0330687,Actor1,2008000,2066000
|
||||
nm0163988,Actor8,2019000,2066000
|
||||
nm1304328,New Secretary,2019000,2066000
|
||||
nm0034309,Actor5,2025000,2066000
|
||||
nm0221046,Actor2,2052000,2066000
|
||||
nm0034309,Actor5,2068000,2293000
|
||||
nm0221046,Actor2,2068000,2293000
|
||||
nm0330687,Actor1,2074000,2293000
|
||||
nm0221046,Actor2,2295000,2482000
|
||||
nm0330687,Actor1,2295000,2482000
|
||||
nm0569501,Narrator,2315000,2482000
|
||||
nm1131557,Actor6,2433000,2482000
|
||||
nm0034309,Actor5,2437000,2482000
|
||||
nm0330687,Actor1,2483000,2626000
|
||||
nm1631269,Actor4,2483000,2626000
|
||||
nm0330687/trivia,nt0127470,2539000,2626000
|
||||
nm0221046,Actor2,2557000,2626000
|
||||
nm0221046,Actor2,2630000,2853000
|
||||
nm0330687,Actor1,2630000,2853000
|
||||
nm1071303,Douche,2656000,2853000
|
||||
nm3300012,Girl on the Stairs,2835000,2853000
|
||||
nm0330687,Actor1,2853000,2984000
|
||||
nm0221046,Actor2,2861000,2984000
|
||||
nm0221046/trivia,nt0085270,2908000,2984000
|
||||
nm0221046,Actor2,2985000,3072000
|
||||
nm0330687,Actor1,2987000,3072000
|
||||
nm2622767,Actor11,3050000,3072000
|
||||
nm0330687,Actor1,3072000,3143000
|
||||
nm0221046,Actor2,3073000,3143000
|
||||
nm0221046,Actor2,3148000,3278000
|
||||
nm0330687,Actor1,3148000,3278000
|
||||
nm0897096,Actor12,3194000,3278000
|
||||
nm0533467,Actor13,3209000,3278000
|
||||
nm3505105,Actor14,3249000,3278000
|
||||
nm1304328,New Secretary,3279000,3406000
|
||||
nm0330687,Actor1,3282000,3406000
|
||||
nm0163988,Actor8,3289000,3406000
|
||||
nm0330687,Actor1,3410000,3625000
|
||||
nm0034309,Actor5,3413000,3625000
|
||||
nm0932891,Actor3,3414000,3625000
|
||||
nm0735538,Employee #1,3438000,3625000
|
||||
nm0006970,Actor9,3443000,3625000
|
||||
nm0381763,Actor7,3443000,3625000
|
||||
nm0281068,Actor15,3446000,3625000
|
||||
nm0221046,Actor2,3450000,3625000
|
||||
nm0715377,Bus Driver,3483000,3625000
|
||||
nm1036340,Actor16,3488000,3625000
|
||||
nm0330687,Actor1,3629000,3841000
|
||||
nm0034309,Actor5,3642000,3841000
|
||||
nm0221046,Actor2,3677000,3841000
|
||||
nm0006970,Actor9,3827000,3841000
|
||||
nm2306384,Minister,3827000,3841000
|
||||
nm3505110,Actor9's New Husband,3827000,3841000
|
||||
nm0221046,Actor2,3841000,3984000
|
||||
nm0006970,Actor9,3847000,3984000
|
||||
nm3505110,Actor9's New Husband,3847000,3984000
|
||||
nm0330687,Actor1,3851000,3984000
|
||||
nm3505106,Wedding Singer,3892000,3984000
|
||||
nm1131557,Actor6,3984000,4054000
|
||||
nm0034309,Actor5,3999000,4054000
|
||||
nm0163988,Actor8,4009000,4054000
|
||||
nm0330687,Actor1,4045000,4054000
|
||||
nm0330687,Actor1,4054000,4249000
|
||||
nm0569501,Narrator,4066000,4249000
|
||||
nm0221046,Actor2,4089000,4249000
|
||||
nm1656122,Partygoer,4134000,4249000
|
||||
nm1497668,Rooftop Guy #1,4168000,4249000
|
||||
nm3107009,Another Partygoer,4194000,4249000
|
||||
nm0330687,Actor1,4254000,4305000
|
||||
nm0330687,Actor1,4305000,4514000
|
||||
nm0034309,Actor5,4305000,4514000
|
||||
nm0381763,Actor7,4310000,4514000
|
||||
nm0281068,Actor10,4328000,4514000
|
||||
nm0803331,Usher,4328000,4514000
|
||||
nm0163988,Actor8,4334000,4514000
|
||||
nm0329622,Office Worker,4334000,4514000
|
||||
nm0330687/trivia,nt0127468,4362000,4514000
|
||||
nm0330687,Actor1,4516000,4740000
|
||||
nm1631269,Actor4,4520000,4740000
|
||||
nm1631269/trivia,nt0787786,4533000,4740000
|
||||
nm0221046,Actor2,4583000,4740000
|
||||
nm1071303,Douche,4593000,4740000
|
||||
nm0000163,Ben,4620000,4740000
|
||||
nm0001684,Elaine,4620000,4740000
|
||||
nm0330687,Actor1,4743000,4882000
|
||||
nm0330687/trivia,nt0920755,4751000,4882000
|
||||
nm0221046,Actor2,4851000,4882000
|
||||
nm0330687,Actor1,4885000,5228000
|
||||
nm0221046,Actor2,4907000,5228000
|
||||
nm0330687,Actor1,5230000,5426000
|
||||
nm0569501,Narrator,5240000,5426000
|
||||
nm1310368,Girl at interview,5263000,5426000
|
||||
|
@@ -0,0 +1,27 @@
|
||||
import plotly.figure_factory as ff
|
||||
|
||||
df = [
|
||||
{"Task": "call depth 4", "Start": 9321, "Finish": 9326},
|
||||
{"Task": "call depth 3", "Start": 9288, "Finish": 9311},
|
||||
{"Task": "call depth 2", "Start": 9126, "Finish": 9141},
|
||||
{"Task": "call depth 1", "Start": 9088, "Finish": 9099},
|
||||
{"Task": "call depth 0", "Start": 9076, "Finish": 9337},
|
||||
{"Task": "call depth 1", "Start": 9109, "Finish": 9179},
|
||||
{"Task": "call depth 1", "Start": 9194, "Finish": 9334},
|
||||
{"Task": "call depth 2", "Start": 9206, "Finish": 9231},
|
||||
{"Task": "call depth 2", "Start": 9237, "Finish": 9269},
|
||||
{"Task": "call depth 2", "Start": 9274, "Finish": 9331},
|
||||
{"Task": "call depth 3", "Start": 9255, "Finish": 9266},
|
||||
{"Task": "call depth 3", "Start": 9279, "Finish": 9284},
|
||||
{"Task": "call depth 4", "Start": 9299, "Finish": 9309},
|
||||
{"Task": "call depth 3", "Start": 9316, "Finish": 9329},
|
||||
]
|
||||
|
||||
fig = ff.create_gantt(df, group_tasks=True, bar_width=0.4, width=1700, height=720)
|
||||
|
||||
fig["data"][0].update(text="apply_arguments_to_function", hoverinfo="text+x+y")
|
||||
fig["data"][1].update(text="apply_arguments_to_function", hoverinfo="text+x+y")
|
||||
fig["data"][2].update(text="apply_arguments_to_function", hoverinfo="text+x+y")
|
||||
|
||||
|
||||
fig.show()
|
||||
@@ -0,0 +1,89 @@
|
||||
import pandas as pd
|
||||
import plotly.graph_objs as go
|
||||
|
||||
call_depths = [0]
|
||||
datas = []
|
||||
|
||||
def ensure_big_enough(list, idx, el):
|
||||
l = len(list)
|
||||
if (idx >= l):
|
||||
list.extend([el]*(idx-l+1))
|
||||
|
||||
def incr_call_depth(thread):
|
||||
ensure_big_enough(call_depths, thread, 0)
|
||||
call_depths[thread] += 1
|
||||
|
||||
def append_to_datas(thread, data):
|
||||
ensure_big_enough(datas, thread, [])
|
||||
datas[thread].append(data)
|
||||
|
||||
with open("../bin/profiler.report", "r") as file:
|
||||
for line in file:
|
||||
infos = line.split()
|
||||
thread = int(infos[0])
|
||||
if infos[1] == "->":
|
||||
incr_call_depth(thread)
|
||||
append_to_datas(thread, {
|
||||
"task": f"[T{thread}] - {'{:03d}'.format(call_depths[thread])}",
|
||||
"start": int(infos[5]),
|
||||
"end": None
|
||||
})
|
||||
elif infos[1] == "<-":
|
||||
call_depths[thread] -= 1
|
||||
for set in datas[thread][::-1]:
|
||||
if set["end"] == None:
|
||||
set["end"] = int(infos[2])
|
||||
break
|
||||
else:
|
||||
print("couldn't find task that finished")
|
||||
break
|
||||
|
||||
else:
|
||||
print("neither -> nor <-")
|
||||
|
||||
|
||||
fig = go.Figure(
|
||||
layout = {
|
||||
'barmode': 'stack',
|
||||
"dragmode" : "pan",
|
||||
}
|
||||
)
|
||||
|
||||
flat_datas= [item for sublist in datas for item in sublist]
|
||||
# i = 1
|
||||
# df = flat_datas[:20]
|
||||
# for call in df:
|
||||
# name = call["task"]
|
||||
# start = call["start"]
|
||||
# end = call["end"]
|
||||
# duration = end,start
|
||||
# fig.add_bar(x=(i,duration),
|
||||
# y=(i,name),
|
||||
# base=(i,start),
|
||||
# orientation='h',
|
||||
# showlegend=False,
|
||||
# name=name,
|
||||
# hovertext=f"yes",
|
||||
# text=""
|
||||
# )
|
||||
# i += 1
|
||||
|
||||
df = pd.DataFrame(flat_datas[:20])
|
||||
df['duration'] = df['end'] - df['start']
|
||||
|
||||
for stackdepth, stackdepth_df in df.groupby('task'):
|
||||
params = {"x": stackdepth_df.duration,
|
||||
"y": stackdepth_df.task,
|
||||
"name": stackdepth,
|
||||
"base": stackdepth_df.start
|
||||
}
|
||||
print(params)
|
||||
fig.add_bar(**params,
|
||||
orientation='h',
|
||||
showlegend=False,
|
||||
hovertext=f"yes",
|
||||
text=""
|
||||
)
|
||||
|
||||
|
||||
fig.show(config={'scrollZoom': True})
|
||||
@@ -0,0 +1,21 @@
|
||||
#lang racket
|
||||
(require racket/gui mrlib/snip-canvas plot)
|
||||
|
||||
(define ((make-current-value-renderer fn) snip event x y)
|
||||
(define overlays
|
||||
(and x y (eq? (send event get-event-type) 'motion)
|
||||
(list (vrule x #:style 'long-dash)
|
||||
(point-label (vector x (fn x)) #:anchor 'auto))))
|
||||
(send snip set-overlay-renderers overlays))
|
||||
|
||||
(define (make-plot-snip width height)
|
||||
(define snip (plot-snip (function sin)
|
||||
#:x-min 0 #:x-max (* 2 pi) #:y-min -1.5 #:y-max 1.5
|
||||
#:width width #:height height))
|
||||
(send snip set-mouse-event-callback (make-current-value-renderer sin))
|
||||
snip)
|
||||
|
||||
(define toplevel (new frame% [label "Plot"] [width 500] [height 200]))
|
||||
(define canvas (new snip-canvas% [parent toplevel] [make-snip make-plot-snip]))
|
||||
(send toplevel show #t)
|
||||
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,173 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8-unix -*-
|
||||
|
||||
import datetime
|
||||
import gantt
|
||||
|
||||
# Change font default
|
||||
gantt.define_font_attributes(fill='black',
|
||||
stroke='black',
|
||||
stroke_width=0,
|
||||
font_family="Verdana")
|
||||
|
||||
# Add vacations for everyone
|
||||
gantt.add_vacations(datetime.date(2014, 12, 25))
|
||||
gantt.add_vacations(datetime.date(2015, 1, 1))
|
||||
gantt.add_vacations(datetime.date(2015, 1, 13))
|
||||
|
||||
# Create two resources
|
||||
rANO = gantt.Resource('ANO')
|
||||
rJLS = gantt.Resource('JLS')
|
||||
|
||||
# Add vacations for one lucky resource
|
||||
rANO.add_vacations(
|
||||
dfrom=datetime.date(2014, 12, 29),
|
||||
dto=datetime.date(2015, 1, 4)
|
||||
)
|
||||
rANO.add_vacations(
|
||||
dfrom=datetime.date(2015, 1, 6),
|
||||
dto=datetime.date(2015, 1, 8)
|
||||
)
|
||||
|
||||
# Test if this resource is avalaible for some dates
|
||||
print(rANO.is_available(datetime.date(2015, 1, 5)))
|
||||
print(rANO.is_available(datetime.date(2015, 1, 8)))
|
||||
print(rANO.is_available(datetime.date(2015, 1, 6)))
|
||||
print(rANO.is_available(datetime.date(2015, 1, 2)))
|
||||
print(rANO.is_available(datetime.date(2015, 1, 1)))
|
||||
|
||||
|
||||
# Create some tasks
|
||||
t1 = gantt.Task(name='tache1',
|
||||
start=datetime.date(2014, 12, 25),
|
||||
duration=4,
|
||||
percent_done=44,
|
||||
resources=[rANO],
|
||||
color="#FF8080")
|
||||
t2 = gantt.Task(name='tache2',
|
||||
start=datetime.date(2014, 12, 28),
|
||||
duration=6,
|
||||
resources=[rJLS])
|
||||
t7 = gantt.Task(name='tache7',
|
||||
start=datetime.date(2014, 12, 28),
|
||||
duration=5,
|
||||
percent_done=50)
|
||||
t3 = gantt.Task(name='tache3',
|
||||
start=datetime.date(2014, 12, 25),
|
||||
duration=4,
|
||||
depends_of=[t1, t7, t2],
|
||||
resources=[rJLS])
|
||||
t4 = gantt.Task(name='tache4',
|
||||
start=datetime.date(2015, 1, 1),
|
||||
duration=4,
|
||||
depends_of=t1,
|
||||
resources=[rJLS])
|
||||
t5 = gantt.Task(name='tache5',
|
||||
start=datetime.date(2014, 12, 23),
|
||||
duration=3)
|
||||
t6 = gantt.Task(name='tache6',
|
||||
start=datetime.date(2014, 12, 25),
|
||||
duration=4,
|
||||
depends_of=t7,
|
||||
resources=[rANO])
|
||||
t8 = gantt.Task(name='tache8',
|
||||
start=datetime.date(2014, 12, 25),
|
||||
duration=4,
|
||||
depends_of=t7,
|
||||
resources=[rANO, rJLS])
|
||||
|
||||
|
||||
# Create a project
|
||||
p1 = gantt.Project(name='Projet 1')
|
||||
|
||||
# Add tasks to this project
|
||||
p1.add_task(t1)
|
||||
p1.add_task(t7)
|
||||
p1.add_task(t2)
|
||||
p1.add_task(t3)
|
||||
p1.add_task(t5)
|
||||
p1.add_task(t8)
|
||||
|
||||
|
||||
|
||||
# Create another project
|
||||
p2 = gantt.Project(name='Projet 2', color='#FFFF40')
|
||||
|
||||
# Add tasks to this project
|
||||
p2.add_task(t2)
|
||||
p2.add_task(t4)
|
||||
|
||||
|
||||
# Create another project
|
||||
p = gantt.Project(name='Gantt')
|
||||
# wich contains the first two projects
|
||||
# and a single task
|
||||
p.add_task(p1)
|
||||
p.add_task(p2)
|
||||
p.add_task(t6)
|
||||
|
||||
|
||||
|
||||
# Test cases for milestones
|
||||
# Create another project
|
||||
ptcm = gantt.Project(name='Test case for milestones')
|
||||
|
||||
tcm11 = gantt.Task(name='tcm11',
|
||||
start=datetime.date(2014, 12, 25),
|
||||
duration=4)
|
||||
tcm12 = gantt.Task(name='tcm12',
|
||||
start=datetime.date(2014, 12, 26),
|
||||
duration=5)
|
||||
ms1 = gantt.Milestone(name=' ',
|
||||
depends_of=[tcm11, tcm12])
|
||||
tcm21 = gantt.Task(name='tcm21',
|
||||
start=datetime.date(2014, 12, 30),
|
||||
duration=4,
|
||||
depends_of=[ms1])
|
||||
tcm22 = gantt.Task(name='tcm22',
|
||||
start=datetime.date(2014, 12, 30),
|
||||
duration=6,
|
||||
depends_of=[ms1])
|
||||
ms2 = gantt.Milestone(name='MS2',
|
||||
depends_of=[ms1, tcm21, tcm22])
|
||||
tcm31 = gantt.Task(name='tcm31',
|
||||
start=datetime.date(2014, 12, 30),
|
||||
duration=6,
|
||||
depends_of=[ms2])
|
||||
ms3 = gantt.Milestone(name='MS3', depends_of=[ms1])
|
||||
|
||||
|
||||
ptcm.add_task(tcm11)
|
||||
ptcm.add_task(tcm12)
|
||||
ptcm.add_task(ms1)
|
||||
ptcm.add_task(tcm21)
|
||||
ptcm.add_task(tcm22)
|
||||
ptcm.add_task(ms2)
|
||||
ptcm.add_task(tcm31)
|
||||
ptcm.add_task(ms3)
|
||||
|
||||
|
||||
p.add_task(ptcm)
|
||||
|
||||
##########################$ MAKE DRAW ###############
|
||||
p.make_svg_for_tasks(filename='test_full.svg',
|
||||
today=datetime.date(2014, 12, 31),
|
||||
start=datetime.date(2014, 8, 22),
|
||||
end=datetime.date(2015, 1, 14))
|
||||
p.make_svg_for_tasks(filename='test_full2.svg',
|
||||
today=datetime.date(2014, 12, 31))
|
||||
p.make_svg_for_tasks(filename='test.svg',
|
||||
today=datetime.date(2014, 12, 31),
|
||||
start=datetime.date(2015, 1, 3),
|
||||
end=datetime.date(2015, 1, 6))
|
||||
p1.make_svg_for_tasks(filename='test_p1.svg',
|
||||
today=datetime.date(2014, 12, 31))
|
||||
p2.make_svg_for_tasks(filename='test_p2.svg',
|
||||
today=datetime.date(2014, 12, 31))
|
||||
p.make_svg_for_resources(filename='test_resources.svg',
|
||||
today=datetime.date(2014, 12, 31),
|
||||
resources=[rANO, rJLS])
|
||||
p.make_svg_for_tasks(filename='test_weekly.svg',
|
||||
today=datetime.date(2014, 12, 31),
|
||||
scale=gantt.DRAW_WITH_WEEKLY_SCALE)
|
||||
##########################$ /MAKE DRAW ###############
|
||||
|
After Width: | Height: | Size: 58 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 21 KiB |