Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/profile/profile.c

    r414 r740  
    2121
    2222#include "includes.h"
     23#include "system/shmem.h"
     24#include "system/filesys.h"
     25#include "messages.h"
     26#include "smbprofile.h"
    2327
    2428#ifdef WITH_PROFILE
     
    2933static int shm_id;
    3034static bool read_only;
    31 #if defined(HAVE_CLOCK_GETTIME)
    32 clockid_t __profile_clock;
    33 bool have_profiling_clock = False;
    34 #endif
    3535#endif
    3636
     
    6161                break;
    6262        case 2:         /* turn on complete profiling */
    63 
    64 #if defined(HAVE_CLOCK_GETTIME)
    65                 if (!have_profiling_clock) {
    66                         do_profile_flag = True;
    67                         do_profile_times = False;
    68                         DEBUG(1,("INFO: Profiling counts turned ON from "
    69                                 "pid %d\n", (int)procid_to_pid(&src)));
    70                         DEBUGADD(1,("INFO: Profiling times disabled "
    71                                 "due to lack of a suitable clock\n"));
    72                         break;
    73                 }
    74 #endif
    75 
    7663                do_profile_flag = True;
    7764                do_profile_times = True;
     
    137124  open the profiling shared memory area
    138125  ******************************************************************/
    139 
    140 #ifdef HAVE_CLOCK_GETTIME
    141 
    142 /* Find a clock. Just because the definition for a particular clock ID is
    143  * present doesn't mean the system actually supports it.
    144  */
    145 static void init_clock_gettime(void)
    146 {
    147         struct timespec ts;
    148 
    149         have_profiling_clock = False;
    150 
    151 #ifdef HAVE_CLOCK_PROCESS_CPUTIME_ID
    152         /* CLOCK_PROCESS_CPUTIME_ID is sufficiently fast that the
    153          * always profiling times is plausible. Unfortunately on Linux
    154          * it is only accurate if we can guarantee we will not be scheduled
    155          * scheduled onto a different CPU between samples. Until there is
    156          * some way to set processor affinity, we can only use this on
    157          * uniprocessors.
    158          */
    159         if (!this_is_smp()) {
    160             if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts) == 0) {
    161                     DEBUG(10, ("Using CLOCK_PROCESS_CPUTIME_ID "
    162                                 "for profile_clock\n"));
    163                     __profile_clock = CLOCK_PROCESS_CPUTIME_ID;
    164                     have_profiling_clock = True;
    165             }
    166         }
    167 #endif
    168 
    169 #ifdef HAVE_CLOCK_MONOTONIC
    170         if (!have_profiling_clock &&
    171             clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
    172                 DEBUG(10, ("Using CLOCK_MONOTONIC for profile_clock\n"));
    173                 __profile_clock = CLOCK_MONOTONIC;
    174                 have_profiling_clock = True;
    175         }
    176 #endif
    177 
    178 #ifdef HAVE_CLOCK_REALTIME
    179         /* POSIX says that CLOCK_REALTIME should be defined everywhere
    180          * where we have clock_gettime...
    181          */
    182         if (!have_profiling_clock &&
    183             clock_gettime(CLOCK_REALTIME, &ts) == 0) {
    184                 __profile_clock = CLOCK_REALTIME;
    185                 have_profiling_clock = True;
    186 
    187                 SMB_WARN(__profile_clock != CLOCK_REALTIME,
    188                         ("forced to use a slow profiling clock"));
    189         }
    190 
    191 #endif
    192 
    193         SMB_WARN(have_profiling_clock == True,
    194                 ("could not find a working clock for profiling"));
    195         return;
    196 }
    197 #endif
    198 
    199126bool profile_setup(struct messaging_context *msg_ctx, bool rdonly)
    200127{
     
    202129
    203130        read_only = rdonly;
    204 
    205 #ifdef HAVE_CLOCK_GETTIME
    206         init_clock_gettime();
    207 #endif
    208131
    209132 again:
     
    315238            "syscall_ntimes",           /* PR_VALUE_SYSCALL_NTIMES */
    316239            "syscall_ftruncate",        /* PR_VALUE_SYSCALL_FTRUNCATE */
     240            "syscall_fallocate",        /* PR_VALUE_SYSCALL_FALLOCATE */
    317241            "syscall_fcntl_lock",       /* PR_VALUE_SYSCALL_FCNTL_LOCK */
    318242            "syscall_kernel_flock",     /* PR_VALUE_SYSCALL_KERNEL_FLOCK */
     
    455379            "run_elections",            /* PR_VALUE_RUN_ELECTIONS */
    456380            "election",                 /* PR_VALUE_ELECTION */
     381            "smb2_negprot",             /* PR_VALUE_SMB2_NEGPROT */
     382            "smb2_sesssetup",           /* PR_VALUE_SMB2_SESSETUP */
     383            "smb2_logoff",              /* PR_VALUE_SMB2_LOGOFF */
     384            "smb2_tcon",                /* PR_VALUE_SMB2_TCON */
     385            "smb2_tdis",                /* PR_VALUE_SMB2_TDIS */
     386            "smb2_create",              /* PR_VALUE_SMB2_CREATE */
     387            "smb2_close",               /* PR_VALUE_SMB2_CLOSE */
     388            "smb2_flush",               /* PR_VALUE_SMB2_FLUSH */
     389            "smb2_read",                /* PR_VALUE_SMB2_READ */
     390            "smb2_write",               /* PR_VALUE_SMB2_WRITE */
     391            "smb2_lock",                /* PR_VALUE_SMB2_LOCK */
     392            "smb2_ioctl",               /* PR_VALUE_SMB2_IOCTL */
     393            "smb2_cancel",              /* PR_VALUE_SMB2_CANCEL */
     394            "smb2_keepalive",           /* PR_VALUE_SMB2_KEEPALIVE */
     395            "smb2_find",                /* PR_VALUE_SMB2_FIND */
     396            "smb2_notify",              /* PR_VALUE_SMB2_NOTIFY */
     397            "smb2_getinfo",             /* PR_VALUE_SMB2_GETINFO */
     398            "smb2_setinfo"              /* PR_VALUE_SMB2_SETINFO */
     399            "smb2_break",               /* PR_VALUE_SMB2_BREAK */
    457400            "" /* PR_VALUE_MAX */
    458401        };
Note: See TracChangeset for help on using the changeset viewer.