mirror of
https://github.com/samba-team/samba.git
synced 2025-03-11 16:58:40 +03:00
profile: Fix rusage reporting
getrusage already gives accumulated values, so add them to the tdb record after smbprofile_stats_accumulate. Maybe we should not zero out our internal copy after writing the tdb, this would save a call to smbprofile_stats_accumulate() once a second. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
This commit is contained in:
parent
8c08b70503
commit
e3b4073d3c
@ -233,6 +233,16 @@ void smbprofile_dump(void)
|
||||
|
||||
pid = tevent_cached_getpid();
|
||||
|
||||
ret = tdb_chainlock(smbprofile_state.internal.db->tdb, key);
|
||||
if (ret != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
tdb_parse_record(smbprofile_state.internal.db->tdb,
|
||||
key, profile_stats_parser, &s);
|
||||
|
||||
smbprofile_stats_accumulate(profile_p, &s);
|
||||
|
||||
#ifdef HAVE_GETRUSAGE
|
||||
ret = getrusage(RUSAGE_SELF, &rself);
|
||||
if (ret != 0) {
|
||||
@ -247,16 +257,6 @@ void smbprofile_dump(void)
|
||||
rself.ru_stime.tv_usec;
|
||||
#endif /* HAVE_GETRUSAGE */
|
||||
|
||||
ret = tdb_chainlock(smbprofile_state.internal.db->tdb, key);
|
||||
if (ret != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
tdb_parse_record(smbprofile_state.internal.db->tdb,
|
||||
key, profile_stats_parser, &s);
|
||||
|
||||
smbprofile_stats_accumulate(profile_p, &s);
|
||||
|
||||
tdb_store(smbprofile_state.internal.db->tdb, key,
|
||||
(TDB_DATA) {
|
||||
.dptr = (uint8_t *)profile_p,
|
||||
|
Loading…
x
Reference in New Issue
Block a user