Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
klee_tutorial
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Niklas Lundberg
klee_tutorial
Commits
7235ace1
Commit
7235ace1
authored
4 years ago
by
Blinningjr
Browse files
Options
Downloads
Patches
Plain Diff
Added schedulable output variable
parent
6f613f81
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
srp_analysis/example/output1.txt
+2
-1
2 additions, 1 deletion
srp_analysis/example/output1.txt
srp_analysis/src/formater.rs
+9
-4
9 additions, 4 deletions
srp_analysis/src/formater.rs
srp_analysis/src/srp_analyser.rs
+17
-0
17 additions, 0 deletions
srp_analysis/src/srp_analyser.rs
with
28 additions
and
5 deletions
srp_analysis/example/output1.txt
+
2
−
1
View file @
7235ace1
Overview
Overview
Schedulable: No
Total Util: 0.85
Total Util: 0.85
Tasks: T1 T2 T3
Tasks: T1 T2 T3
Priority: P(R1) = 2 P(T
2
) =
2
P(T
1
) =
1
P(R2) = 3 P(T3) = 3
Priority: P(R1) = 2 P(T
1
) =
1
P(T
2
) =
2
P(R2) = 3 P(T3) = 3
Task Resources: T2:( R1 R2 ) T3:( R2 )
Task Resources: T2:( R1 R2 ) T3:( R2 )
Analysis of T1
Analysis of T1
...
...
This diff is collapsed.
Click to expand it.
srp_analysis/src/formater.rs
+
9
−
4
View file @
7235ace1
...
@@ -6,7 +6,7 @@ use super::srp_analyser::*;
...
@@ -6,7 +6,7 @@ use super::srp_analyser::*;
* Creates a readable representation of the analysis and the given information.
* Creates a readable representation of the analysis and the given information.
*/
*/
pub
fn
format_analysis
(
analysis
:
&
Vec
<
AnalysedTask
>
,
tasks
:
&
Tasks
,
ip
:
&
IdPrio
,
tr
:
&
TaskResources
)
->
String
{
pub
fn
format_analysis
(
analysis
:
&
Vec
<
AnalysedTask
>
,
tasks
:
&
Tasks
,
ip
:
&
IdPrio
,
tr
:
&
TaskResources
)
->
String
{
let
overview
=
format_overview
(
tasks
,
ip
,
tr
);
let
overview
=
format_overview
(
tasks
,
ip
,
tr
,
analysis
);
let
mut
body
=
String
::
new
();
let
mut
body
=
String
::
new
();
for
at
in
analysis
{
for
at
in
analysis
{
...
@@ -26,7 +26,7 @@ pub fn format_analysis(analysis: &Vec<AnalysedTask>, tasks: &Tasks, ip: &IdPrio,
...
@@ -26,7 +26,7 @@ pub fn format_analysis(analysis: &Vec<AnalysedTask>, tasks: &Tasks, ip: &IdPrio,
/*
/*
* Creates the overview section of the readable representation.
* Creates the overview section of the readable representation.
*/
*/
pub
fn
format_overview
(
tasks
:
&
Tasks
,
ip
:
&
IdPrio
,
tr
:
&
TaskResources
)
->
String
{
pub
fn
format_overview
(
tasks
:
&
Tasks
,
ip
:
&
IdPrio
,
tr
:
&
TaskResources
,
atasks
:
&
Vec
<
AnalysedTask
>
)
->
String
{
// Formats the names of all the tasks.
// Formats the names of all the tasks.
fn
format_task_names
(
tasks
:
&
Tasks
)
->
String
{
fn
format_task_names
(
tasks
:
&
Tasks
)
->
String
{
let
mut
task_names
=
"Tasks:"
.to_string
();
let
mut
task_names
=
"Tasks:"
.to_string
();
...
@@ -60,13 +60,18 @@ pub fn format_overview(tasks: &Tasks, ip: &IdPrio, tr: &TaskResources) -> String
...
@@ -60,13 +60,18 @@ pub fn format_overview(tasks: &Tasks, ip: &IdPrio, tr: &TaskResources) -> String
}
}
return
task_res
;
return
task_res
;
}
}
let
ltot
=
total_load_factor
(
tasks
);
let
tot_util
=
format!
(
"Total Util: {}"
,
total_load_factor
(
tasks
));
let
schedulable
=
format!
(
"Schedulable: {}"
,
match
schedulable
(
ltot
,
atasks
)
{
true
=>
"Yes"
,
false
=>
"No"
,
});
let
tot_util
=
format!
(
"Total Util: {}"
,
ltot
);
let
task_names
=
format_task_names
(
tasks
);
let
task_names
=
format_task_names
(
tasks
);
let
id_prio
=
format_id_prio
(
ip
);
let
id_prio
=
format_id_prio
(
ip
);
let
task_res
=
format_task_res
(
tr
);
let
task_res
=
format_task_res
(
tr
);
return
format!
(
"Overview
\n\t
{}
\n\t
{}
\n\t
{}
\n\t
{}
"
,
tot_util
,
task_names
,
id_prio
,
task_res
);
return
format!
(
"Overview
\n\t
{}
\n\t
{}
\n\t
{}
\n\t
{}
\n\t
{}"
,
schedulable
,
tot_util
,
task_names
,
id_prio
,
task_res
);
}
}
...
...
This diff is collapsed.
Click to expand it.
srp_analysis/src/srp_analyser.rs
+
17
−
0
View file @
7235ace1
...
@@ -175,6 +175,23 @@ pub fn interference_time(task: &Task, tasks: &Tasks, ip: &IdPrio, tr: &TaskResou
...
@@ -175,6 +175,23 @@ pub fn interference_time(task: &Task, tasks: &Tasks, ip: &IdPrio, tr: &TaskResou
}
}
/*
* Calculate if it is schedulable.
*/
pub
fn
schedulable
(
ltot
:
f32
,
atasks
:
&
Vec
<
AnalysedTask
>
)
->
bool
{
if
ltot
>=
1.0
{
return
false
;
}
for
at
in
atasks
{
if
at
.response_time
>=
at
.task.deadline
{
return
false
;
}
}
return
true
;
}
/*
/*
* Analyse tasks.
* Analyse tasks.
*
*
...
...
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