Bug 863429: Fix jprof on debug builds, remove evilness NPOTB DONTBUILD rs=dbaron
--- a/tools/jprof/bfd.cpp
+++ b/tools/jprof/bfd.cpp
@@ -95,41 +95,59 @@ static bfd *find_debug_file(bfd *lib, co
delete[] filename;
free(dirbuf);
delete[] debuglink;
return debugFile;
}
-#define NEXT_SYMBOL \
- sp++; \
- if (sp >= lastSymbol) { \
- long n = numExternalSymbols + 10000; \
- externalSymbols = (Symbol*) \
- realloc(externalSymbols, (size_t) (sizeof(Symbol) * n)); \
- lastSymbol = externalSymbols + n; \
- sp = externalSymbols + numExternalSymbols; \
- numExternalSymbols = n; \
+
+// Use an indirect array to avoid copying tons of objects
+Symbol ** leaky::ExtendSymbols(int num)
+{
+ long n = numExternalSymbols + num;
+
+ externalSymbols = (Symbol**)
+ realloc(externalSymbols,
+ (size_t) (sizeof(externalSymbols[0]) * n));
+ Symbol *new_array = new Symbol[n];
+ for (int i = 0; i < num; i++) {
+ externalSymbols[i + numExternalSymbols] = &new_array[i];
}
+ lastSymbol = externalSymbols + n;
+ Symbol **sp = externalSymbols + numExternalSymbols;
+ numExternalSymbols = n;
+ return sp;
+}
+
+#define NEXT_SYMBOL do { sp++; \
+ if (sp >= lastSymbol) { \
+ sp = ExtendSymbols(16384); \
+ } \
+ } while (0)
void leaky::ReadSymbols(const char *aFileName, u_long aBaseAddress)
{
int initialSymbols = usefulSymbols;
if (NULL == externalSymbols) {
- externalSymbols = (Symbol*) malloc(sizeof(Symbol) * 10000);
+ externalSymbols = (Symbol**) calloc(sizeof(Symbol*),10000);
+ Symbol *new_array = new Symbol[10000];
+ for (int i = 0; i < 10000; i++) {
+ externalSymbols[i] = &new_array[i];
+ }
numExternalSymbols = 10000;
}
- Symbol* sp = externalSymbols + usefulSymbols;
- Symbol* lastSymbol = externalSymbols + numExternalSymbols;
+ Symbol** sp = externalSymbols + usefulSymbols;
+ lastSymbol = externalSymbols + numExternalSymbols;
// Create a dummy symbol for the library so, if it doesn't have any
// symbols, we show it by library.
- sp->Init(aFileName, aBaseAddress);
- NEXT_SYMBOL
+ (*sp)->Init(aFileName, aBaseAddress);
+ NEXT_SYMBOL;
bfd_boolean kDynamic = (bfd_boolean) false;
static int firstTime = 1;
if (firstTime) {
firstTime = 0;
bfd_init ();
}
@@ -179,29 +197,29 @@ void leaky::ReadSymbols(const char *aFil
sym = bfd_minisymbol_to_symbol(symbolFile, kDynamic, (const PTR) from, store);
symbol_info syminfo;
bfd_get_symbol_info (symbolFile, sym, &syminfo);
// if ((syminfo.type == 'T') || (syminfo.type == 't')) {
const char* nm = bfd_asymbol_name(sym);
if (nm && nm[0]) {
- char* dnm = NULL;
- if (strncmp("__thunk", nm, 7)) {
- dnm = cplus_demangle(nm, 1);
- }
- sp->Init(dnm ? dnm : nm, syminfo.value + aBaseAddress);
- NEXT_SYMBOL
+ char* dnm = NULL;
+ if (strncmp("__thunk", nm, 7)) {
+ dnm = cplus_demangle(nm, 1);
+ }
+ (*sp)->Init(dnm ? dnm : nm, syminfo.value + aBaseAddress);
+ NEXT_SYMBOL;
}
// }
}
bfd_close(symbolFile);
int interesting = sp - externalSymbols;
if (!quiet) {
printf("%s provided %d symbols\n", aFileName,
- interesting - initialSymbols);
+ interesting - initialSymbols);
}
usefulSymbols = interesting;
}
#endif /* USE_BFD */
--- a/tools/jprof/intcnt.cpp
+++ b/tools/jprof/intcnt.cpp
@@ -1,67 +1,71 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "intcnt.h"
-IntCount::IntCount() : numInts(0), iPair(0) { }
+IntCount::IntCount() : numInts(0), iPair(nullptr) { }
IntCount::~IntCount() { delete [] iPair;}
int IntCount::getSize() {return numInts;}
int IntCount::getCount(int pos) {return iPair[pos].cnt;}
int IntCount::getIndex(int pos) {return iPair[pos].idx;}
void IntCount::clear()
{
delete[] iPair;
iPair = new IntPair[0];
numInts = 0;
}
int IntCount::countAdd(int index, int increment)
{
- if(numInts) {
- // Do a binary search to find the element
- int divPoint = 0;
+ if(numInts) {
+ // Do a binary search to find the element
+ int divPoint = 0;
- if(index>iPair[numInts-1].idx) {
+ if(index>iPair[numInts-1].idx) {
divPoint = numInts;
- } else if(index<iPair[0].idx) {
+ } else if(index<iPair[0].idx) {
divPoint = 0;
- } else {
+ } else {
int low=0, high=numInts-1;
int mid = (low+high)/2;
while(1) {
- mid = (low+high)/2;
+ mid = (low+high)/2;
- if(index<iPair[mid].idx) {
- high = mid;
- } else if(index>iPair[mid].idx) {
- if(mid<numInts-1 && index<iPair[mid+1].idx) {
- divPoint = mid+1;
- break;
- } else {
- low = mid+1;
- }
- } else if(index==iPair[mid].idx) {
- return iPair[mid].cnt += increment;
- }
+ if(index<iPair[mid].idx) {
+ high = mid;
+ } else if(index>iPair[mid].idx) {
+ if(mid<numInts-1 && index<iPair[mid+1].idx) {
+ divPoint = mid+1;
+ break;
+ } else {
+ low = mid+1;
+ }
+ } else if(index==iPair[mid].idx) {
+ return iPair[mid].cnt += increment;
+ }
}
- }
+ }
- int i;
- IntPair *tpair = new IntPair[numInts+1];
- for(i=0; i<divPoint; i++) tpair[i] = iPair[i];
- for(i=divPoint; i<numInts; i++) tpair[i+1] = iPair[i];
- ++numInts;
- delete [] iPair;
- iPair = tpair;
- iPair[divPoint].idx = index;
- iPair[divPoint].cnt = increment;
- return increment;
- } else {
- iPair = new IntPair[1];
- numInts = 1;
- iPair[0].idx = index;
- return iPair[0].cnt = increment;
+ int i;
+ IntPair *tpair = new IntPair[numInts+1];
+ for(i=0; i<divPoint; i++) {
+ tpair[i] = iPair[i];
+ }
+ for(i=divPoint; i<numInts; i++) {
+ tpair[i+1] = iPair[i];
}
+ ++numInts;
+ delete [] iPair;
+ iPair = tpair;
+ iPair[divPoint].idx = index;
+ iPair[divPoint].cnt = increment;
+ return increment;
+ } else {
+ iPair = new IntPair[1];
+ numInts = 1;
+ iPair[0].idx = index;
+ return iPair[0].cnt = increment;
+ }
}
--- a/tools/jprof/intcnt.h
+++ b/tools/jprof/intcnt.h
@@ -12,16 +12,27 @@ public:
~IntCount();
void clear();
int countAdd(int index, int increment=1);
int countGet(int index);
int getSize();
int getCount(int pos);
int getIndex(int pos);
+ IntCount(const IntCount&old)
+ {
+ numInts = old.numInts;
+ if (numInts > 0) {
+ iPair = new IntPair[numInts];
+ for (int i = 0; i < numInts; i++) {
+ iPair[i] = old.iPair[i];
+ }
+ } else {
+ iPair = nullptr;
+ }
+ }
private:
- IntCount(const IntCount&); // No copy constructor
int numInts;
struct IntPair{int idx; int cnt;} *iPair;
};
#endif
--- a/tools/jprof/leaky.cpp
+++ b/tools/jprof/leaky.cpp
@@ -424,16 +424,18 @@ void leaky::open(char *logFile)
fprintf(stderr,"Num threads %d\n",numThreads);
if (!cleo) {
fprintf(outputfd,"<hr>Threads:<p><pre>\n");
for (int i=0; i<numThreads; i++)
{
fprintf(outputfd," <a href=\"#thread_%d\">%d</a> ",
threadArray[i],threadArray[i]);
+ if ((i+1)%10 == 0)
+ fprintf(outputfd,"<br>\n");
}
fprintf(outputfd,"</pre>");
}
for (int i=0; i<numThreads; i++)
{
if (!onlyThread || onlyThread == threadArray[i])
analyze(threadArray[i]);
@@ -448,20 +450,20 @@ void leaky::open(char *logFile)
fprintf(outputfd,"</pre></body></html>\n");
}
//----------------------------------------------------------------------
static int symbolOrder(void const* a, void const* b)
{
- Symbol const* ap = (Symbol const *)a;
- Symbol const* bp = (Symbol const *)b;
- return ap->address == bp->address ? 0 :
- (ap->address > bp->address ? 1 : -1);
+ Symbol const** ap = (Symbol const **)a;
+ Symbol const** bp = (Symbol const **)b;
+ return (*ap)->address == (*bp)->address ? 0 :
+ ((*ap)->address > (*bp)->address ? 1 : -1);
}
void leaky::ReadSharedLibrarySymbols()
{
LoadMapEntry* lme = loadMap;
while (NULL != lme) {
ReadSymbols(lme->name, lme->address);
lme = lme->next;
@@ -479,40 +481,40 @@ void leaky::setupSymbols(const char *fil
// Read in symbols from the .so's
ReadSharedLibrarySymbols();
if (!quiet) {
fprintf(stderr,"A total of %d symbols were loaded\n", usefulSymbols);
}
// Now sort them
- qsort(externalSymbols, usefulSymbols, sizeof(Symbol), symbolOrder);
- lowestSymbolAddr = externalSymbols[0].address;
- highestSymbolAddr = externalSymbols[usefulSymbols-1].address;
+ qsort(externalSymbols, usefulSymbols, sizeof(Symbol *), symbolOrder);
+ lowestSymbolAddr = externalSymbols[0]->address;
+ highestSymbolAddr = externalSymbols[usefulSymbols-1]->address;
}
}
// Binary search the table, looking for a symbol that covers this
// address.
int leaky::findSymbolIndex(u_long addr)
{
u_int base = 0;
u_int limit = usefulSymbols - 1;
- Symbol* end = &externalSymbols[limit];
+ Symbol** end = &externalSymbols[limit];
while (base <= limit) {
u_int midPoint = (base + limit)>>1;
- Symbol* sp = &externalSymbols[midPoint];
- if (addr < sp->address) {
+ Symbol** sp = &externalSymbols[midPoint];
+ if (addr < (*sp)->address) {
if (midPoint == 0) {
return -1;
}
limit = midPoint - 1;
} else {
if (sp+1 < end) {
- if (addr < (sp+1)->address) {
+ if (addr < (*(sp+1))->address) {
return midPoint;
}
} else {
return midPoint;
}
base = midPoint + 1;
}
}
@@ -521,17 +523,17 @@ int leaky::findSymbolIndex(u_long addr)
Symbol* leaky::findSymbol(u_long addr)
{
int idx = findSymbolIndex(addr);
if(idx<0) {
return NULL;
} else {
- return &externalSymbols[idx];
+ return externalSymbols[idx];
}
}
//----------------------------------------------------------------------
bool leaky::excluded(malloc_log_entry* lep)
{
if (exclusions.IsEmpty()) {
@@ -639,104 +641,104 @@ void leaky::generateReportHTML(FILE *fp,
fprintf(fp,
"<h2><A NAME=hier_%d></A><center><a href=\"http://mxr.mozilla.org/mozilla-central/source/tools/jprof/README.html#hier\">Hierarchical Profile</a></center></h2><hr>\n",
thread);
fprintf(fp, "<pre>\n");
fprintf(fp, "%6s %6s %4s %s\n",
"index", "Count", "Hits", "Function Name");
for(i=0; i<usefulSymbols && countArray[rankingTable[i]]>0; i++) {
- Symbol *sp=&externalSymbols[rankingTable[i]];
+ Symbol **sp=&externalSymbols[rankingTable[i]];
- sp->cntP.printReport(fp, this, rankingTable[i], totalTimerHits);
+ (*sp)->cntP.printReport(fp, this, rankingTable[i], totalTimerHits);
- char *symname = htmlify(sp->name);
+ char *symname = htmlify((*sp)->name);
fprintf(fp, "%6d %6d (%3.1f%%)%s <a name=%d>%8d (%3.1f%%)</a>%s <b>%s</b>\n",
rankingTable[i],
- sp->timerHit, (sp->timerHit*1000/totalTimerHits)/10.0,
- (sp->timerHit*1000/totalTimerHits)/10.0 >= 10.0 ? "" : " ",
+ (*sp)->timerHit, ((*sp)->timerHit*1000/totalTimerHits)/10.0,
+ ((*sp)->timerHit*1000/totalTimerHits)/10.0 >= 10.0 ? "" : " ",
rankingTable[i], countArray[rankingTable[i]],
(countArray[rankingTable[i]]*1000/totalTimerHits)/10.0,
(countArray[rankingTable[i]]*1000/totalTimerHits)/10.0 >= 10.0 ? "" : " ",
symname);
delete [] symname;
- sp->cntC.printReport(fp, this, rankingTable[i], totalTimerHits);
+ (*sp)->cntC.printReport(fp, this, rankingTable[i], totalTimerHits);
fprintf(fp, "<hr>\n");
}
fprintf(fp,"</pre>\n");
// OK, Now we want to print the flat profile. To do this we resort on
// the hit count.
// Cut-N-Paste Shell sort from above. The Ranking Table has already been
// populated, so we do not have to reinitialize it.
for(mx=usefulSymbols/9, h=581130733; h>0; h/=3) {
if(h<mx) {
for(i = h-1; i<usefulSymbols; i++) {
- int j, tmp=rankingTable[i], val = externalSymbols[tmp].timerHit;
+ int j, tmp=rankingTable[i], val = externalSymbols[tmp]->timerHit;
for(j = i;
- (j>=h) && (externalSymbols[rankingTable[j-h]].timerHit<val); j-=h) {
+ (j>=h) && (externalSymbols[rankingTable[j-h]]->timerHit<val); j-=h) {
rankingTable[j] = rankingTable[j-h];
}
rankingTable[j] = tmp;
}
}
}
// Pre-count up total counter hits, to get a percentage.
// I wanted the total before walking the list, if this
// double-pass over externalSymbols gets slow we can
// do single-pass and print this out after the loop finishes.
totalTimerHits = 0;
for(i=0;
- i<usefulSymbols && externalSymbols[rankingTable[i]].timerHit>0; i++) {
- Symbol *sp=&externalSymbols[rankingTable[i]];
- totalTimerHits += sp->timerHit;
+ i<usefulSymbols && externalSymbols[rankingTable[i]]->timerHit>0; i++) {
+ Symbol **sp=&externalSymbols[rankingTable[i]];
+ totalTimerHits += (*sp)->timerHit;
}
if (totalTimerHits == 0)
totalTimerHits = 1;
if (totalTimerHits != count)
fprintf(stderr,"Hit count mismatch: count=%d; totalTimerHits=%d",
count,totalTimerHits);
fprintf(fp,"<h2><A NAME=flat_%d></A><center><a href=\"http://mxr.mozilla.org/mozilla-central/source/tools/jprof/README.html#flat\">Flat Profile</a></center></h2><br>\n",
thread);
fprintf(fp, "<pre>\n");
fprintf(fp, "Total hit count: %d\n", totalTimerHits);
fprintf(fp, "Count %%Total Function Name\n");
// Now loop for as long as we have timer hits
for(i=0;
- i<usefulSymbols && externalSymbols[rankingTable[i]].timerHit>0; i++) {
+ i<usefulSymbols && externalSymbols[rankingTable[i]]->timerHit>0; i++) {
- Symbol *sp=&externalSymbols[rankingTable[i]];
+ Symbol **sp=&externalSymbols[rankingTable[i]];
- char *symname = htmlify(sp->name);
+ char *symname = htmlify((*sp)->name);
fprintf(fp, "<a href=\"#%d\">%3d %-2.1f %s</a>\n",
- rankingTable[i], sp->timerHit,
- ((float)sp->timerHit/(float)totalTimerHits)*100.0, symname);
+ rankingTable[i], (*sp)->timerHit,
+ ((float)(*sp)->timerHit/(float)totalTimerHits)*100.0, symname);
delete [] symname;
}
}
void leaky::analyze(int thread)
{
int *countArray = new int[usefulSymbols];
int *flagArray = new int[usefulSymbols];
//Zero our function call counter
memset(countArray, 0, sizeof(countArray[0])*usefulSymbols);
// reset hit counts
for(int i=0; i<usefulSymbols; i++) {
- externalSymbols[i].timerHit = 0;
- externalSymbols[i].regClear();
+ externalSymbols[i]->timerHit = 0;
+ externalSymbols[i]->regClear();
}
// The flag array is used to prevent counting symbols multiple times
// if functions are called recursively. In order to keep from having
// to zero it on each pass through the loop, we mark it with the value
// of stacks on each trip through the loop. This means we can determine
// if we have seen this symbol for this stack trace w/o having to reset
// from the prior stacktrace.
@@ -768,69 +770,69 @@ void leaky::analyze(int thread)
// backwards we know who called the function when we get there.
char type = 's';
for (int i=n-1; i>=0; --i, --pcp) {
idx = findSymbolIndex(reinterpret_cast<u_long>(*pcp));
if(idx>=0) {
// Skip over bogus __restore_rt frames that realtime profiling
// can introduce.
- if (i > 0 && !strcmp(externalSymbols[idx].name, "__restore_rt")) {
+ if (i > 0 && !strcmp(externalSymbols[idx]->name, "__restore_rt")) {
--pcp;
--i;
idx = findSymbolIndex(reinterpret_cast<u_long>(*pcp));
if (idx < 0) {
continue;
}
}
- Symbol *sp=&externalSymbols[idx];
- char *symname = htmlify(sp->name);
+ Symbol **sp=&externalSymbols[idx];
+ char *symname = htmlify((*sp)->name);
fprintf(outputfd,"%c-%s\n",type,symname);
delete [] symname;
}
// else can't find symbol - ignore
type = 'c';
}
} else {
// This loop walks through every symbol in the call stack. By walking it
// backwards we know who called the function when we get there.
for (int i=n-1; i>=0; --i, --pcp) {
idx = findSymbolIndex(reinterpret_cast<u_long>(*pcp));
if(idx>=0) {
// Skip over bogus __restore_rt frames that realtime profiling
// can introduce.
- if (i > 0 && !strcmp(externalSymbols[idx].name, "__restore_rt")) {
+ if (i > 0 && !strcmp(externalSymbols[idx]->name, "__restore_rt")) {
--pcp;
--i;
idx = findSymbolIndex(reinterpret_cast<u_long>(*pcp));
if (idx < 0) {
continue;
}
}
// If we have not seen this symbol before count it and mark it as seen
if(flagArray[idx]!=stacks && ((flagArray[idx]=stacks) || true)) {
++countArray[idx];
}
// We know who we are and we know who our parrent is. Count this
if(parrentIdx>=0) {
- externalSymbols[parrentIdx].regChild(idx);
- externalSymbols[idx].regParrent(parrentIdx);
+ externalSymbols[parrentIdx]->regChild(idx);
+ externalSymbols[idx]->regParrent(parrentIdx);
}
// inside if() so an unknown in the middle of a stack won't break
// the link!
parrentIdx=idx;
}
}
// idx should be the function that we were in when we received the signal.
if(idx>=0) {
- ++externalSymbols[idx].timerHit;
+ ++externalSymbols[idx]->timerHit;
}
}
}
if (!cleo)
generateReportHTML(outputfd, countArray, stacks, thread);
}
--- a/tools/jprof/leaky.h
+++ b/tools/jprof/leaky.h
@@ -70,17 +70,18 @@ struct leaky {
int mappedLogFile;
malloc_log_entry* firstLogEntry;
malloc_log_entry* lastLogEntry;
int stacks;
int sfd;
- Symbol* externalSymbols;
+ Symbol** externalSymbols;
+ Symbol** lastSymbol;
int usefulSymbols;
int numExternalSymbols;
StrSet exclusions;
u_long lowestSymbolAddr;
u_long highestSymbolAddr;
LoadMapEntry* loadMap;
@@ -99,22 +100,23 @@ struct leaky {
void dumpEntryToLog(malloc_log_entry* lep);
void insertAddress(u_long address, malloc_log_entry* lep);
void removeAddress(u_long address, malloc_log_entry* lep);
void displayStackTrace(FILE* out, malloc_log_entry* lep);
+ Symbol ** ExtendSymbols(int num);
void ReadSymbols(const char* fileName, u_long aBaseAddress);
void ReadSharedLibrarySymbols();
void setupSymbols(const char* fileName);
Symbol* findSymbol(u_long address);
bool excluded(malloc_log_entry* lep);
bool included(malloc_log_entry* lep);
- const char* indexToName(int idx) {return externalSymbols[idx].name;}
+ const char* indexToName(int idx) {return externalSymbols[idx]->name;}
private:
void generateReportHTML(FILE *fp, int *countArray, int count, int thread);
int findSymbolIndex(u_long address);
};
#endif /* __leaky_h_ */
--- a/tools/jprof/stub/libmalloc.cpp
+++ b/tools/jprof/stub/libmalloc.cpp
@@ -442,17 +442,17 @@ static void startSignalCounter(unsigned
if (realTime) {
setitimer(ITIMER_REAL, &tvalue, NULL);
} else {
setitimer(ITIMER_PROF, &tvalue, NULL);
}
}
-static long timerMiliSec = 50;
+static long timerMilliSec = 50;
#if defined(linux)
static int setupRTCSignals(int hz, struct sigaction *sap)
{
/* global */ rtcFD = open("/dev/rtc", O_RDONLY);
if (rtcFD < 0) {
perror("JPROF_RTC setup: open(\"/dev/rtc\", O_RDONLY)");
return 0;
@@ -564,17 +564,17 @@ void *ucontext)
gregset_t &gregs = ((ucontext_t*)ucontext)->uc_mcontext.gregs;
#ifdef __x86_64__
JprofLog(millisec, (void*)gregs[REG_RSP], (void*)gregs[REG_RIP]);
#else
JprofLog(millisec, (void*)gregs[REG_ESP], (void*)gregs[REG_EIP]);
#endif
if (!rtcHz)
- startSignalCounter(timerMiliSec);
+ startSignalCounter(timerMilliSec);
}
NS_EXPORT_(void) setupProfilingStuff(void)
{
static int gFirstTime = 1;
char filename[2048]; // XXX fix
if(gFirstTime && !(gFirstTime=0)) {
@@ -616,22 +616,22 @@ NS_EXPORT_(void) setupProfilingStuff(voi
if(strstr(tst, "JP_START")) doNotStart = 0;
if(strstr(tst, "JP_REALTIME")) realTime = 1;
if(strstr(tst, "JP_APPEND")) append = O_APPEND;
char *delay = strstr(tst,"JP_PERIOD=");
if(delay) {
double tmp = strtod(delay+strlen("JP_PERIOD="), NULL);
if (tmp>=1e-3) {
- timerMiliSec = static_cast<unsigned long>(1000 * tmp);
+ timerMilliSec = static_cast<unsigned long>(1000 * tmp);
} else {
fprintf(stderr,
"JP_PERIOD of %g less than 0.001 (1ms), using 1ms\n",
tmp);
- timerMiliSec = 1;
+ timerMilliSec = 1;
}
}
char *circular_op = strstr(tst,"JP_CIRCULAR=");
if(circular_op) {
size_t size = atol(circular_op+strlen("JP_CIRCULAR="));
if (size < 1000) {
fprintf(stderr,
@@ -648,17 +648,17 @@ NS_EXPORT_(void) setupProfilingStuff(voi
if(first) {
firstDelay = atol(first+strlen("JP_FIRST="));
}
char *rtc = strstr(tst, "JP_RTC_HZ=");
if (rtc) {
#if defined(linux)
rtcHz = atol(rtc+strlen("JP_RTC_HZ="));
- timerMiliSec = 0; /* This makes JP_FIRST work right. */
+ timerMilliSec = 0; /* This makes JP_FIRST work right. */
realTime = 1; /* It's the _R_TC and all. ;) */
#define IS_POWER_OF_TWO(x) (((x) & ((x) - 1)) == 0)
if (!IS_POWER_OF_TWO(rtcHz) || rtcHz < 2) {
fprintf(stderr, "JP_RTC_HZ must be power of two and >= 2, "
"but %d was provided; using default of 2048\n",
rtcHz);
@@ -749,34 +749,34 @@ NS_EXPORT_(void) setupProfilingStuff(voi
stop_action.sa_handler = ClearProfilingHook;
stop_action.sa_mask = mset;
stop_action.sa_flags = SA_RESTART;
sigaction(SIGUSR2, &stop_action, NULL);
printf("Jprof: Initialized signal handler and set "
"timer for %lu %s, %d s "
"initial delay\n",
- rtcHz ? rtcHz : timerMiliSec,
+ rtcHz ? rtcHz : timerMilliSec,
rtcHz ? "Hz" : "ms",
firstDelay);
if(startTimer) {
#if defined(linux)
/* If we have an initial delay we can just use
startSignalCounter to set up a timer to fire the
first stackHook after that delay. When that happens
we'll go and switch to RTC profiling. */
if (rtcHz && firstDelay == 0) {
puts("Jprof: enabled RTC signals");
enableRTCSignals(true);
} else
#endif
{
puts("Jprof: started timer");
- startSignalCounter(firstDelay*1000 + timerMiliSec);
+ startSignalCounter(firstDelay*1000 + timerMilliSec);
}
}
}
}
}
} else {
printf("setupProfilingStuff() called multiple times\n");
}