Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Test-Project
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
haoczhao
Test-Project
Commits
0559ac36
Commit
0559ac36
authored
4 years ago
by
haoczhao
Browse files
Options
Downloads
Patches
Plain Diff
free
parent
df87e61d
Branches
master
No related tags found
No related merge requests found
Pipeline
#67997
failed
4 years ago
Stage: test
Changes
6
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
allocate.c
+0
-2
0 additions, 2 deletions
allocate.c
allocate.h
+1
-1
1 addition, 1 deletion
allocate.h
task1.c
+1
-0
1 addition, 0 deletions
task1.c
task2.c
+2
-0
2 additions, 0 deletions
task2.c
task3.c
+11
-0
11 additions, 0 deletions
task3.c
tools.c
+11
-0
11 additions, 0 deletions
tools.c
with
26 additions
and
3 deletions
allocate.c
+
0
−
2
View file @
0559ac36
...
@@ -36,5 +36,3 @@ int main(int argc, char *argv[])
...
@@ -36,5 +36,3 @@ int main(int argc, char *argv[])
return
0
;
return
0
;
}
}
This diff is collapsed.
Click to expand it.
allocate.h
+
1
−
1
View file @
0559ac36
...
@@ -61,7 +61,7 @@ void show_stat(int timer, int *turn_around_array, int *ini_exe_array, int num_pr
...
@@ -61,7 +61,7 @@ void show_stat(int timer, int *turn_around_array, int *ini_exe_array, int num_pr
int
find_sub_process
(
int
parallel_pro_id
,
process_t
**
cpu_queue
,
int
queue_len
);
int
find_sub_process
(
int
parallel_pro_id
,
process_t
**
cpu_queue
,
int
queue_len
);
int
adding_new_process
(
process_t
**
new_processes
,
process_t
**
all_process_array
,
int
adding_new_process
(
process_t
**
new_processes
,
process_t
**
all_process_array
,
int
num_process
,
int
timer
,
int
*
rest_proc
);
int
num_process
,
int
timer
,
int
*
rest_proc
);
void
free_all_process_array
(
process_t
**
all_process_array
);
/* task1 */
/* task1 */
...
...
This diff is collapsed.
Click to expand it.
task1.c
+
1
−
0
View file @
0559ac36
...
@@ -84,6 +84,7 @@ void check_finished_pro_T1(process_t *cur_processing_pro, int *rest_proc, int ti
...
@@ -84,6 +84,7 @@ void check_finished_pro_T1(process_t *cur_processing_pro, int *rest_proc, int ti
/* record information for the performance statistics*/
/* record information for the performance statistics*/
record_perform_info
(
turn_around_array
,
ini_exe_array
,
performance_index
,
cur_processing_pro
,
timer
);
record_perform_info
(
turn_around_array
,
ini_exe_array
,
performance_index
,
cur_processing_pro
,
timer
);
free
(
cur_processing_pro
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
task2.c
+
2
−
0
View file @
0559ac36
...
@@ -194,6 +194,8 @@ void processing_lst(int *finished_array_index, int *finished_array, process_t **
...
@@ -194,6 +194,8 @@ void processing_lst(int *finished_array_index, int *finished_array, process_t **
*
finished_process
+=
1
;
*
finished_process
+=
1
;
}
}
free
(
cur_processing_pro
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
task3.c
+
11
−
0
View file @
0559ac36
...
@@ -71,6 +71,16 @@ void load_task3(process_t **all_process_array, int num_process, char *processors
...
@@ -71,6 +71,16 @@ void load_task3(process_t **all_process_array, int num_process, char *processors
/* Performance statistics: */
/* Performance statistics: */
show_stat
(
timer
,
turn_around_array
,
ini_exe_array
,
num_process
);
show_stat
(
timer
,
turn_around_array
,
ini_exe_array
,
num_process
);
/* free the all_cpu_lst */
for
(
int
i
=
0
;
i
<
num_processors
;
i
++
){
for
(
int
j
=
0
;
j
<
all_cpus_lst
[
i
]
->
running_lst_len
;
j
++
){
free
(
all_cpus_lst
[
i
]
->
cpu_running_lst
[
j
]);
}
free
(
all_cpus_lst
[
i
]
->
cpu_running_lst
);
free
(
all_cpus_lst
[
i
]);
}
free
(
all_cpus_lst
);
}
}
/* allocate all new arrive processes to cpus */
/* allocate all new arrive processes to cpus */
...
@@ -259,6 +269,7 @@ void processing_each_cpu_lst(int *finished_process, int *rest_proc, int timer, l
...
@@ -259,6 +269,7 @@ void processing_each_cpu_lst(int *finished_process, int *rest_proc, int timer, l
delete_head
(
cur_cpu_running_lst
,
&
selected_cpu_lst
->
running_lst_len
);
delete_head
(
cur_cpu_running_lst
,
&
selected_cpu_lst
->
running_lst_len
);
*
finished_process
+=
1
;
*
finished_process
+=
1
;
}
}
free
(
cur_processing_pro
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
tools.c
+
11
−
0
View file @
0559ac36
...
@@ -213,3 +213,14 @@ void record_perform_info(int *turn_around_array, int *ini_exe_array, int *perfor
...
@@ -213,3 +213,14 @@ void record_perform_info(int *turn_around_array, int *ini_exe_array, int *perfor
ini_exe_array
[
*
performance_index
]
=
cur_processing_pro
->
ini_exe_time
;
ini_exe_array
[
*
performance_index
]
=
cur_processing_pro
->
ini_exe_time
;
*
performance_index
+=
1
;
*
performance_index
+=
1
;
}
}
/* free the array*/
void
free_all_process_array
(
process_t
**
all_process_array
){
for
(
int
i
=
0
;
i
<
PROCESS_SIZE
;
i
++
){
free
(
all_process_array
[
i
]);
}
free
(
all_process_array
);
}
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