1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

s3:profile: make use of tevent_cached_getpid() in performance critical code

This avoids wasting getpid() during profiling.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jul 25 18:32:18 UTC 2022 on sn-devel-184
This commit is contained in:
Stefan Metzmacher 2022-07-25 14:29:35 +02:00 committed by Jeremy Allison
parent 0f544f3363
commit cf6cc948e0

View File

@ -280,7 +280,7 @@ static int profile_stats_parser(TDB_DATA key, TDB_DATA value,
void smbprofile_dump(void)
{
pid_t pid = getpid();
pid_t pid = 0;
TDB_DATA key = { .dptr = (uint8_t *)&pid, .dsize = sizeof(pid) };
struct profile_stats s = {};
int ret;
@ -299,6 +299,8 @@ void smbprofile_dump(void)
return;
}
pid = tevent_cached_getpid();
#ifdef HAVE_GETRUSAGE
ret = getrusage(RUSAGE_SELF, &rself);
if (ret != 0) {