Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B-ASIC - Better ASIC Toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computer Engineering
B-ASIC - Better ASIC Toolbox
Commits
0ea2f654
Commit
0ea2f654
authored
2 years ago
by
Mikael Henriksson
Browse files
Options
Downloads
Patches
Plain Diff
Draw ticks in draw_exclusion_graph_coloring() for processes with zero execution time (closes
#172
)
parent
cf6e5808
No related branches found
No related tags found
1 merge request
!194
Draw ticks in draw_exclusion_graph_coloring() for processes with zero execution time (closes #172)
Pipeline
#89834
passed
2 years ago
Stage: test
Stage: deploy
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
b_asic/resources.py
+19
-7
19 additions, 7 deletions
b_asic/resources.py
test/baseline/test_draw_matrix_transposer_4.png
+0
-0
0 additions, 0 deletions
test/baseline/test_draw_matrix_transposer_4.png
with
19 additions
and
7 deletions
b_asic/resources.py
+
19
−
7
View file @
0ea2f654
import
re
from
typing
import
Dict
,
List
,
Optional
,
Set
,
Tuple
,
Union
from
typing
import
Dict
,
Iterable
,
List
,
Optional
,
Set
,
Tuple
,
TypeVar
,
Union
import
matplotlib.pyplot
as
plt
import
networkx
as
nx
...
...
@@ -8,9 +8,16 @@ from matplotlib.ticker import MaxNLocator
from
b_asic.process
import
Process
#
# Human-intuitive sorting:
# https://stackoverflow.com/questions/2669059/how-to-sort-alpha-numeric-set-in-python
#
# Typing '_T' to help Pyright propagate type-information
#
_T
=
TypeVar
(
'
_T
'
)
# From https://stackoverflow.com/questions/2669059/how-to-sort-alpha-numeric-set-in-python
def
_sorted_nicely
(
to_be_sorted
)
:
def
_sorted_nicely
(
to_be_sorted
:
Iterable
[
_T
])
->
List
[
_T
]
:
"""
Sort the given iterable in the way that humans expect.
"""
convert
=
lambda
text
:
int
(
text
)
if
text
.
isdigit
()
else
text
alphanum_key
=
lambda
key
:
[
...
...
@@ -92,7 +99,7 @@ class ProcessCollection:
----------
collection : set of :class:`~b_asic.process.Process` objects
The Process objects forming this ProcessCollection.
schedule_time : int
, default: 0
schedule_time : int
Length of the time-axis in the generated graph.
cyclic : bool, default: False
If the processes operates cyclically, i.e., if time 0 == time *schedule_time*.
...
...
@@ -130,7 +137,7 @@ class ProcessCollection:
Parameters
----------
ax : :class:`matplotlib.axes.Axes`, optional
Matplotlib Axes object to draw this lifetime chart onto. If not provided (i.e., set to None), this will
Matplotlib Axes object to draw this lifetime chart onto. If not provided (i.e., set to None), this
method
will
return a new axes object on return.
show_name : bool, default: True
Show name of all processes in the lifetime chart.
...
...
@@ -146,7 +153,7 @@ class ProcessCollection:
else
:
_ax
=
ax
#
Draw the l
ifetime chart
#
L
ifetime chart
left and right padding
PAD_L
,
PAD_R
=
0.05
,
0.05
max_execution_time
=
max
(
process
.
execution_time
for
process
in
self
.
_collection
...
...
@@ -157,12 +164,17 @@ class ProcessCollection:
f
'
Error: Schedule time:
{
self
.
_schedule_time
}
< Max execution
'
f
'
time:
{
max_execution_time
}
'
)
# Generate the life-time chart
for
i
,
process
in
enumerate
(
_sorted_nicely
(
self
.
_collection
)):
bar_start
=
process
.
start_time
%
self
.
_schedule_time
bar_end
=
(
process
.
start_time
+
process
.
execution_time
)
%
self
.
_schedule_time
if
bar_end
>
bar_start
:
if
process
.
execution_time
==
0
:
# Process has no execution time, draw a tick
_ax
.
scatter
(
x
=
bar_start
,
y
=
i
+
1
,
marker
=
'
X
'
,
color
=
'
blue
'
)
elif
bar_end
>
bar_start
:
_ax
.
broken_barh
(
[(
PAD_L
+
bar_start
,
bar_end
-
bar_start
-
PAD_L
-
PAD_R
)],
(
i
+
0.55
,
0.9
),
...
...
This diff is collapsed.
Click to expand it.
test/baseline/test_draw_matrix_transposer_4.png
+
0
−
0
View replaced file @
cf6e5808
View file @
0ea2f654
20.9 KiB
|
W:
|
H:
21 KiB
|
W:
|
H:
2-up
Swipe
Onion skin
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment