return;
}
- struct sigaction sa;
- CALL_UTIL (memset)(&sa, 0, sizeof (struct sigaction));
+ static struct sigaction sigaction_0 = {.sa_flags = SA_SIGINFO };
+ struct sigaction sa = sigaction_0;
sa.sa_sigaction = __collector_SIGCHLD_signal_handler;
- sa.sa_flags = SA_SIGINFO;
__collector_sigaction (SIGCHLD, &sa, &original_sigchld_sigaction);
/* linetrace interposition takes care of unsetting Environment variables */
return 0;
int fd;
int res;
- struct prusage usage;
struct rusage rusage;
hrtime_t hrt, delta;
return ( hrt);
}
- CALL_UTIL (memset)(&usage, 0, sizeof (struct prusage));
+ static struct prusage usage_0 = { .pr_count = 1 };
+ struct prusage usage = usage_0;
usage.pr_lwpid = getpid ();
- usage.pr_count = 1;
usage.pr_tstamp.tv_sec = hrt / NANOSEC;
usage.pr_tstamp.tv_nsec = hrt % NANOSEC;
usage.pr_create.tv_sec = starttime / NANOSEC;
DISPATCH_TST = 2 /* dispatcher installed, and enabled in testing mode */
};
+static struct sigaction sigaction_0;
static int dispatch_mode = DISPATCH_NYI; /* controls SIGPROF dispatching */
static int itimer_period_requested = 0; /* dispatcher itimer period */
static int itimer_period_actual = 0; /* actual dispatcher itimer period */
TprintfT (DBG_LT1, "dispatcher: __collector_ext_dispatcher_install() collector_sigprof_dispatcher already installed\n");
else
{
- struct sigaction c_act;
- CALL_UTIL (memset)(&c_act, 0, sizeof c_act);
+ struct sigaction c_act = sigaction_0;
sigemptyset (&c_act.sa_mask);
sigaddset (&c_act.sa_mask, HWCFUNCS_SIGNAL); /* block SIGEMT delivery in handler */
c_act.sa_sigaction = collector_sigprof_dispatcher;
__collector_SIGDFL_handler (int sig)
{
/* remove our dispatcher, replacing it with the default disposition */
- struct sigaction act;
- CALL_UTIL (memset)(&act, 0, sizeof (act));
+ struct sigaction act = sigaction_0;
act.sa_handler = SIG_DFL;
if (__collector_sigaction (sig, &act, NULL))
{
#include <signal.h>
#include "gp-defs.h"
-#define _STRING_H 1 /* XXX MEZ: temporary workaround */
#include "hwcdrv.h"
#include "collector_module.h"
#include "gp-experiment.h"
else
{
/* set our signal handler */
- struct sigaction c_act;
- CALL_UTIL (memset)(&c_act, 0, sizeof c_act);
+ static struct sigaction c_act_0 = {.sa_flags = SA_RESTART | SA_SIGINFO};
+ struct sigaction c_act = c_act_0;
sigemptyset (&c_act.sa_mask);
sigaddset (&c_act.sa_mask, SIGPROF); /* block SIGPROF delivery in handler */
/* XXXX should probably also block sample_sig & pause_sig */
uint64_t va, uint64_t latency,
uint64_t data_source)
{
- MHwcntr_packet pckt;
- CALL_UTIL (memset)(&pckt, 0, sizeof ( MHwcntr_packet));
+ static MHwcntr_packet hwc_packet_0 = {.comm.type = HW_PCKT,
+ .comm.tsize = sizeof (Hwcntr_packet)};
+ MHwcntr_packet pckt = hwc_packet_0;
pckt.comm.tstamp = time;
pckt.tag = tag;
if (timecvt > 1)
value *= timecvt;
}
pckt.interval = value;
- pckt.comm.type = HW_PCKT;
- pckt.comm.tsize = sizeof (Hwcntr_packet);
TprintfT (DBG_LT4, "hwprofile: %llu sample %lld tag %u recorded\n",
(unsigned long long) time, (long long) value, tag);
if (ABS_memop == ABST_NOPC)
err = (*jvmti)->GetPotentialCapabilities (jvmti, &cpblts);
if (err == JVMTI_ERROR_NONE)
{
- jvmtiCapabilities cpblts_set;
- CALL_UTIL (memset)(&cpblts_set, 0, sizeof (cpblts_set));
+ static jvmtiCapabilities cpblts_set_0;
+ jvmtiCapabilities cpblts_set = cpblts_set_0;
/* Add only those capabilities that are among potential ones */
cpblts_set.can_get_source_file_name = cpblts.can_get_source_file_name;
CALL_UTIL (getcontext) (context); /* initialize dummy context */
SETFUNCTIONCONTEXT (context, &__collector_lost_profile_context);
}
- ClockPacket pckt;
- CALL_UTIL (memset)(&pckt, 0, sizeof ( pckt));
- pckt.comm.tsize = sizeof ( pckt);
- pckt.comm.type = CLOCK_TYPE;
+ static ClockPacket clock_pckt_0 = {.comm.type = CLOCK_TYPE,
+ .comm.tsize = sizeof (ClockPacket)};
+ ClockPacket pckt = clock_pckt_0;
pckt.lwp_id = __collector_lwp_self ();
pckt.thr_id = __collector_thr_self ();
pckt.cpu_id = CALL_UTIL (getcpuid)();
static long sync_threshold = -1; /* calibrate the value */
static int init_thread_intf_started = 0;
static int init_thread_intf_finished = 0;
+static Sync_packet spacket_0 = { .comm.tsize = sizeof ( Sync_packet) };
#define CHCK_NREENTRANCE(x) (!sync_native || !sync_mode || ((x) = collector_interface->getKey( sync_key )) == NULL || (*(x) != 0))
#define RECHCK_NREENTRANCE(x) (!sync_native || !sync_mode || ((x) = collector_interface->getKey( sync_key )) == NULL || (*(x) == 0))
pthread_mutex_t *restrict mutex,
const struct timespec *restrict abstime) = NULL;
-
-static void
-collector_memset (void *s, int c, size_t n)
-{
- unsigned char *s1 = s;
- while (n--)
- *s1++ = (unsigned char) c;
-}
-
void
__collector_module_init (CollectorInterface *_collector_interface)
{
hrtime_t grnt = gethrtime ();
if (grnt - reqt >= sync_threshold)
{
- Sync_packet spacket;
- collector_memset (&spacket, 0, sizeof (Sync_packet));
- spacket.comm.tsize = sizeof (Sync_packet);
+ Sync_packet spacket = spacket_0;
spacket.comm.tstamp = grnt;
spacket.requested = reqt;
spacket.objp = (intptr_t) object;
hrtime_t grnt = gethrtime ();
if (grnt - reqt >= sync_threshold)
{
- Sync_packet spacket;
- collector_memset (&spacket, 0, sizeof (Sync_packet));
- spacket.comm.tsize = sizeof (Sync_packet);
+ Sync_packet spacket = spacket_0;
spacket.comm.tstamp = grnt;
spacket.requested = reqt;
spacket.objp = (intptr_t) mp;
hrtime_t grnt = gethrtime ();
if (grnt - reqt >= sync_threshold)
{
- Sync_packet spacket;
- collector_memset (&spacket, 0, sizeof (Sync_packet));
- spacket.comm.tsize = sizeof (Sync_packet);
+ Sync_packet spacket = spacket_0;
spacket.comm.tstamp = grnt;
spacket.requested = reqt;
spacket.objp = (intptr_t) mutex;
hrtime_t grnt = gethrtime ();
if (grnt - reqt >= sync_threshold)
{
- Sync_packet spacket;
- collector_memset (&spacket, 0, sizeof (Sync_packet));
- spacket.comm.tsize = sizeof (Sync_packet);
+ Sync_packet spacket = spacket_0;
spacket.comm.tstamp = grnt;
spacket.requested = reqt;
spacket.objp = (intptr_t) mutex;
hrtime_t grnt = gethrtime ();
if (grnt - reqt >= sync_threshold)
{
- Sync_packet spacket;
- collector_memset (&spacket, 0, sizeof (Sync_packet));
- spacket.comm.tsize = sizeof (Sync_packet);
+ Sync_packet spacket = spacket_0;
spacket.comm.tstamp = grnt;
spacket.requested = reqt;
spacket.objp = (Vaddr_type) target_thread;
hrtime_t grnt = gethrtime ();
if (grnt - reqt >= sync_threshold)
{
- Sync_packet spacket;
- collector_memset (&spacket, 0, sizeof (Sync_packet));
- spacket.comm.tsize = sizeof (Sync_packet);
+ Sync_packet spacket = spacket_0;
spacket.comm.tstamp = grnt;
spacket.requested = reqt;
spacket.objp = (intptr_t) sp;