Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
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
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
libremedia
Tethys
FFmpeg
Commits
11153a93
Commit
11153a93
authored
12 years ago
by
Michael Niedermayer
Browse files
Options
Downloads
Patches
Plain Diff
avio: Collect and print statistics of bytes read & seeks
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
f77a695d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libavformat/avio.h
+12
-0
12 additions, 0 deletions
libavformat/avio.h
libavformat/aviobuf.c
+4
-0
4 additions, 0 deletions
libavformat/aviobuf.c
with
16 additions
and
0 deletions
libavformat/avio.h
+
12
−
0
View file @
11153a93
...
@@ -128,6 +128,18 @@ typedef struct {
...
@@ -128,6 +128,18 @@ typedef struct {
* call the underlying seek function directly.
* call the underlying seek function directly.
*/
*/
int
direct
;
int
direct
;
/**
* Bytes read statistic
* This field is internal to libavformat and access from outside is not allowed.
*/
int64_t
bytes_read
;
/**
* seek statistic
* This field is internal to libavformat and access from outside is not allowed.
*/
int
seek_count
;
}
AVIOContext
;
}
AVIOContext
;
/* unbuffered I/O */
/* unbuffered I/O */
...
...
This diff is collapsed.
Click to expand it.
libavformat/aviobuf.c
+
4
−
0
View file @
11153a93
...
@@ -237,6 +237,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
...
@@ -237,6 +237,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
return
AVERROR
(
EPIPE
);
return
AVERROR
(
EPIPE
);
if
((
res
=
s
->
seek
(
s
->
opaque
,
offset
,
SEEK_SET
))
<
0
)
if
((
res
=
s
->
seek
(
s
->
opaque
,
offset
,
SEEK_SET
))
<
0
)
return
res
;
return
res
;
s
->
seek_count
++
;
if
(
!
s
->
write_flag
)
if
(
!
s
->
write_flag
)
s
->
buf_end
=
s
->
buffer
;
s
->
buf_end
=
s
->
buffer
;
s
->
buf_ptr
=
s
->
buffer
;
s
->
buf_ptr
=
s
->
buffer
;
...
@@ -423,6 +424,7 @@ static void fill_buffer(AVIOContext *s)
...
@@ -423,6 +424,7 @@ static void fill_buffer(AVIOContext *s)
s
->
pos
+=
len
;
s
->
pos
+=
len
;
s
->
buf_ptr
=
dst
;
s
->
buf_ptr
=
dst
;
s
->
buf_end
=
dst
+
len
;
s
->
buf_end
=
dst
+
len
;
s
->
bytes_read
+=
len
;
}
}
}
}
...
@@ -792,6 +794,8 @@ int avio_close(AVIOContext *s)
...
@@ -792,6 +794,8 @@ int avio_close(AVIOContext *s)
h
=
s
->
opaque
;
h
=
s
->
opaque
;
av_free
(
s
->
buffer
);
av_free
(
s
->
buffer
);
if
(
!
s
->
write_flag
)
av_log
(
s
,
AV_LOG_DEBUG
,
"Statistics: %"
PRId64
" bytes read, %d seeks
\n
"
,
s
->
bytes_read
,
s
->
seek_count
);
av_free
(
s
);
av_free
(
s
);
return
ffurl_close
(
h
);
return
ffurl_close
(
h
);
}
}
...
...
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