Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
f3112de7
Commit
f3112de7
authored
Jan 27, 2006
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Improve timers (Refs:#473)
* AccessOutWrite can be called with input already detached (Closes:#523)
parent
9c139c97
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
31 deletions
+73
-31
src/libvlc.c
src/libvlc.c
+1
-0
src/misc/stats.c
src/misc/stats.c
+54
-22
src/playlist/playlist.c
src/playlist/playlist.c
+6
-0
src/stream_output/stream_output.c
src/stream_output/stream_output.c
+12
-9
No files found.
src/libvlc.c
View file @
f3112de7
...
...
@@ -940,6 +940,7 @@ int VLC_CleanUp( int i_object )
while
(
(
p_stats
=
vlc_object_find
(
p_vlc
,
VLC_OBJECT_STATS
,
FIND_CHILD
)
))
{
stats_TimersDumpAll
(
p_vlc
);
stats_HandlerDestroy
(
p_stats
);
vlc_object_detach
(
(
vlc_object_t
*
)
p_stats
);
vlc_object_release
(
(
vlc_object_t
*
)
p_stats
);
...
...
src/misc/stats.c
View file @
f3112de7
...
...
@@ -40,6 +40,8 @@ static int stats_CounterUpdate( stats_handler_t *p_handler,
static
stats_handler_t
*
stats_HandlerCreate
(
vlc_object_t
*
p_this
);
static
stats_handler_t
*
stats_HandlerGet
(
vlc_object_t
*
p_this
);
static
void
TimerDump
(
vlc_object_t
*
p_this
,
counter_t
*
p_counter
,
vlc_bool_t
);
/*****************************************************************************
* Exported functions
*****************************************************************************/
...
...
@@ -444,36 +446,28 @@ void __stats_TimerStop( vlc_object_t *p_obj, const char *psz_name )
void
__stats_TimerDump
(
vlc_object_t
*
p_obj
,
const
char
*
psz_name
)
{
mtime_t
last
,
total
;
int
i_total
;
counter_t
*
p_counter
=
stats_CounterGet
(
p_obj
,
p_obj
->
p_vlc
->
i_object_id
,
psz_name
);
if
(
!
p_counter
||
p_counter
->
i_samples
!=
2
)
{
msg_Err
(
p_obj
,
"timer %s does not exist"
,
psz_name
);
return
;
}
i_total
=
p_counter
->
pp_samples
[
1
]
->
value
.
i_int
;
total
=
p_counter
->
pp_samples
[
1
]
->
date
;
if
(
p_counter
->
pp_samples
[
0
]
->
value
.
b_bool
==
VLC_TRUE
)
{
last
=
mdate
()
-
p_counter
->
pp_samples
[
0
]
->
date
;
i_total
+=
1
;
total
+=
last
;
}
else
{
last
=
p_counter
->
pp_samples
[
0
]
->
date
;
}
msg_Dbg
(
p_obj
,
"TIMER %s : %.3f ms - Total %.3f ms / %i intvls (Avg %.3f ms)"
,
psz_name
,
(
float
)
last
/
1000
,
(
float
)
total
/
1000
,
i_total
,
(
float
)(
total
)
/
(
1000
*
(
float
)
i_total
)
);
TimerDump
(
p_obj
,
p_counter
,
VLC_TRUE
);
}
void
__stats_TimersDumpAll
(
vlc_object_t
*
p_obj
)
{
int
i
;
stats_handler_t
*
p_handler
=
stats_HandlerGet
(
p_obj
);
if
(
!
p_handler
)
return
;
vlc_mutex_lock
(
&
p_handler
->
object_lock
);
for
(
i
=
0
;
i
<
p_handler
->
i_counters
;
i
++
)
{
if
(
p_handler
->
pp_counters
[
i
]
->
i_compute_type
==
STATS_TIMER
)
{
TimerDump
(
p_obj
,
p_handler
->
pp_counters
[
i
],
VLC_FALSE
);
}
}
vlc_mutex_unlock
(
&
p_handler
->
object_lock
);
}
...
...
@@ -672,3 +666,41 @@ static stats_handler_t* stats_HandlerCreate( vlc_object_t *p_this )
return
p_handler
;
}
static
void
TimerDump
(
vlc_object_t
*
p_obj
,
counter_t
*
p_counter
,
vlc_bool_t
b_total
)
{
mtime_t
last
,
total
;
int
i_total
;
if
(
!
p_counter
||
p_counter
->
i_samples
!=
2
)
{
msg_Err
(
p_obj
,
"timer %s does not exist"
,
p_counter
->
psz_name
);
return
;
}
i_total
=
p_counter
->
pp_samples
[
1
]
->
value
.
i_int
;
total
=
p_counter
->
pp_samples
[
1
]
->
date
;
if
(
p_counter
->
pp_samples
[
0
]
->
value
.
b_bool
==
VLC_TRUE
)
{
last
=
mdate
()
-
p_counter
->
pp_samples
[
0
]
->
date
;
i_total
+=
1
;
total
+=
last
;
}
else
{
last
=
p_counter
->
pp_samples
[
0
]
->
date
;
}
if
(
b_total
)
{
msg_Dbg
(
p_obj
,
"TIMER %s : %.3f ms - Total %.3f ms / %i intvls (Avg %.3f ms)"
,
p_counter
->
psz_name
,
(
float
)
last
/
1000
,
(
float
)
total
/
1000
,
i_total
,
(
float
)(
total
)
/
(
1000
*
(
float
)
i_total
)
);
}
else
{
msg_Dbg
(
p_obj
,
"TIMER %s : Total %.3f ms / %i intvls (Avg %.3f ms)"
,
p_counter
->
psz_name
,
(
float
)
total
/
1000
,
i_total
,
(
float
)(
total
)
/
(
1000
*
(
float
)
i_total
)
);
}
}
src/playlist/playlist.c
View file @
f3112de7
...
...
@@ -593,7 +593,9 @@ static void RunThread ( playlist_t *p_playlist )
i_loops
++
;
if
(
p_playlist
->
p_interaction
)
{
stats_TimerStart
(
p_playlist
,
"Interaction thread"
);
intf_InteractionManage
(
p_playlist
);
stats_TimerStop
(
p_playlist
,
"Interaction thread"
);
}
vlc_mutex_lock
(
&
p_playlist
->
object_lock
);
...
...
@@ -700,7 +702,9 @@ static void RunThread ( playlist_t *p_playlist )
{
/* Start another input.
* Get the next item to play */
stats_TimerStart
(
p_playlist
,
"Playlist walk"
);
p_item
=
NextItem
(
p_playlist
);
stats_TimerStop
(
p_playlist
,
"Playlist walk"
);
/* We must stop */
if
(
p_item
==
NULL
)
...
...
@@ -862,7 +866,9 @@ static void RunPreparse ( playlist_preparse_t *p_obj )
strncmp
(
p_current
->
input
.
psz_uri
,
"dshow:"
,
6
)
)
{
b_preparsed
=
VLC_TRUE
;
stats_TimerStart
(
p_playlist
,
"Preparse run"
);
input_Preparse
(
p_playlist
,
&
p_current
->
input
);
stats_TimerStop
(
p_playlist
,
"Preparse run"
);
}
vlc_mutex_unlock
(
&
p_playlist
->
object_lock
);
if
(
b_preparsed
)
...
...
src/stream_output/stream_output.c
View file @
f3112de7
...
...
@@ -32,6 +32,7 @@
#include <vlc/vlc.h>
#include <vlc/sout.h>
#include <vlc/input.h>
#include "vlc_meta.h"
...
...
@@ -367,15 +368,17 @@ int sout_AccessOutWrite( sout_access_out_t *p_access, block_t *p_buffer )
{
int
i_total
;
/* Access_out -> sout_instance -> input_thread_t */
stats_UpdateInteger
(
p_access
->
p_parent
->
p_parent
,
"sout_sent_packets"
,
1
);
stats_UpdateInteger
(
p_access
->
p_parent
->
p_parent
,
"sout_sent_bytes"
,
p_buffer
->
i_buffer
);
stats_GetInteger
(
p_access
->
p_parent
->
p_parent
,
p_access
->
p_parent
->
p_parent
->
i_object_id
,
"sout_sent_bytes"
,
&
i_total
);
stats_UpdateFloat
(
p_access
->
p_parent
->
p_parent
,
"sout_send_bitrate"
,
(
float
)
i_total
);
input_thread_t
*
p_input
=
(
input_thread_t
*
)
vlc_object_find
(
p_access
,
VLC_OBJECT_INPUT
,
FIND_PARENT
);
if
(
p_input
)
{
stats_UpdateInteger
(
p_input
,
"sout_sent_packets"
,
1
);
stats_UpdateInteger
(
p_input
,
"sout_sent_bytes"
,
p_buffer
->
i_buffer
);
stats_GetInteger
(
p_input
,
p_access
->
p_parent
->
p_parent
->
i_object_id
,
"sout_sent_bytes"
,
&
i_total
);
stats_UpdateFloat
(
p_input
,
"sout_send_bitrate"
,
(
float
)
i_total
);
vlc_object_release
(
p_input
);
}
return
p_access
->
pf_write
(
p_access
,
p_buffer
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment