mirror of
https://github.com/ossrs/srs.git
synced 2025-02-13 03:41:55 +00:00
Research: Add cost analysis
This commit is contained in:
parent
a4d1b3e2ca
commit
c3938ddfd2
1 changed files with 13 additions and 0 deletions
|
@ -49,6 +49,19 @@ int main(int argc, char** argv)
|
|||
);
|
||||
}
|
||||
|
||||
// The cost for loop.
|
||||
if (true) {
|
||||
int64_t start = srs_update_system_time();
|
||||
|
||||
for (long long i = 0; i < 1000000LL; i++);
|
||||
int64_t ts_loop = srs_update_system_time();
|
||||
|
||||
for (long long i = 0; i < 10000000LL; i++);
|
||||
int64_t ts_loop2 = srs_update_system_time();
|
||||
|
||||
printf("[COST] loop 100w=%dus, 1000w=%dus\n", srsu2i(ts_loop - start), srsu2i(ts_loop2 - ts_loop));
|
||||
}
|
||||
|
||||
// The cost for printf.
|
||||
if (true) {
|
||||
int64_t start = srs_update_system_time();
|
||||
|
|
Loading…
Reference in a new issue