1 /*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "ffrt_inner.h"
17 #include "common.h"
18
19 static std::vector<uint32_t> duration_sample = {50, 60, 70, 80, 90, 100, 120, 140, 160, 180, 200, 500, 1000};
20
main()21 int main()
22 {
23 int64_t ffrt_time;
24 int64_t single_t_time;
25 uint32_t count = 10000;
26 PreHotFFRT();
27
28 for (uint32_t i = 0; i < duration_sample.size(); i++) {
29 single_thread(count, duration_sample[i], single_t_time);
30 completely_serial(count, duration_sample[i], ffrt_time);
31 float sched_time = (1.0f * ffrt_time - single_t_time) / count;
32 printf("completely serial count:%u duration:%u ffrt_time:%ld single_t_time:%ld "
33 "sched_time:%.2f\n",
34 count, duration_sample[i], ffrt_time, single_t_time, sched_time);
35 }
36 return 0;
37 }
38