Changeset: a4435365a7af for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a4435365a7af
Modified Files:
gdk/gdk_bbp.c
gdk/gdk_heap.c
gdk/gdk_storage.c
gdk/gdk_system.c
sql/backends/monet5/vaults/fits/fits.c
Branch: default
Log Message:
No need for GDKms, use GDKusec instead.
diffs (truncated from 419 to 300 lines):
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -3705,7 +3705,7 @@ gdk_return
BBPsync(int cnt, bat *restrict subcommit, BUN *restrict sizes, lng logno, lng
transid)
{
gdk_return ret = GDK_SUCCEED;
- int t0 = 0, t1 = 0;
+ lng t0 = 0, t1 = 0;
str bakdir, deldir;
const bool lock = locked_by == 0 || locked_by != MT_getpid();
char buf[3000];
@@ -3719,7 +3719,7 @@ BBPsync(int cnt, bat *restrict subcommit
return GDK_FAIL;
}
- TRC_DEBUG_IF(PERF) t0 = t1 = GDKms();
+ TRC_DEBUG_IF(PERF) t0 = t1 = GDKusec();
ret = BBPprepare(subcommit != NULL);
@@ -3767,7 +3767,7 @@ BBPsync(int cnt, bat *restrict subcommit
if (idx < cnt)
ret = GDK_FAIL;
}
- TRC_DEBUG(PERF, "move time %d, %d files\n", (t1 = GDKms()) - t0,
backup_files);
+ TRC_DEBUG(PERF, "move time "LLFMT" usec, %d files\n", (t1 = GDKusec())
- t0, backup_files);
/* PHASE 2: save the repository and write new BBP.dir file */
if (ret == GDK_SUCCEED) {
@@ -3831,13 +3831,13 @@ BBPsync(int cnt, bat *restrict subcommit
}
}
- TRC_DEBUG(PERF, "write time %d\n", (t0 = GDKms()) - t1);
+ TRC_DEBUG(PERF, "write time "LLFMT" usec\n", (t0 = GDKusec()) - t1);
if (ret == GDK_SUCCEED) {
ret = BBPdir_last(n, buf, sizeof(buf), obbpf, nbbpf);
}
- TRC_DEBUG(PERF, "dir time %d, %d bats\n", (t1 = GDKms()) - t0, (bat)
ATOMIC_GET(&BBPsize));
+ TRC_DEBUG(PERF, "dir time "LLFMT" usec, %d bats\n", (t1 = GDKusec()) -
t0, (bat) ATOMIC_GET(&BBPsize));
if (ret == GDK_SUCCEED) {
/* atomic switchover */
@@ -3873,9 +3873,9 @@ BBPsync(int cnt, bat *restrict subcommit
backup_files = 1;
}
}
- TRC_DEBUG(PERF, "%s (ready time %d)\n",
+ TRC_DEBUG(PERF, "%s (ready time "LLFMT" usec)\n",
ret == GDK_SUCCEED ? "" : " failed",
- (t0 = GDKms()) - t1);
+ (t0 = GDKusec()) - t1);
/* turn off the BBPSYNCING bits for all bats, even when things
* didn't go according to plan (i.e., don't check for ret ==
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -745,7 +745,7 @@ HEAPload_intern(Heap *h, const char *nme
size_t minsize;
int ret = 0;
char *srcpath, *dstpath;
- int t0;
+ lng t0;
if (h->storage == STORE_INVALID || h->newstorage == STORE_INVALID) {
size_t allocated;
@@ -802,11 +802,11 @@ HEAPload_intern(Heap *h, const char *nme
}
strconcat_len(srcpath, minsize, dstpath, suffix, NULL);
- t0 = GDKms();
+ t0 = GDKusec();
ret = MT_rename(srcpath, dstpath);
- TRC_DEBUG(HEAP, "rename %s %s = %d %s (%dms)\n",
+ TRC_DEBUG(HEAP, "rename %s %s = %d %s ("LLFMT"usec)\n",
srcpath, dstpath, ret, ret < 0 ? GDKstrerror(errno,
(char[128]){0}, 128) : "",
- GDKms() - t0);
+ GDKusec() - t0);
GDKfree(srcpath);
GDKfree(dstpath);
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -326,7 +326,8 @@ GDKmove(int farmid, const char *dir1, co
{
char *path1;
char *path2;
- int ret, t0 = GDKms();
+ int ret;
+ lng t0 = GDKusec();
if (nme1 == NULL || *nme1 == 0) {
GDKerror("no file specified\n");
@@ -339,7 +340,7 @@ GDKmove(int farmid, const char *dir1, co
if (ret < 0 && report)
GDKsyserror("cannot rename %s to %s\n", path1, path2);
- TRC_DEBUG(IO_, "Move %s %s = %d (%dms)\n", path1, path2, ret,
GDKms() - t0);
+ TRC_DEBUG(IO_, "Move %s %s = %d ("LLFMT" usec)\n", path1,
path2, ret, GDKusec() - t0);
} else {
ret = -1;
}
@@ -353,7 +354,7 @@ GDKextendf(int fd, size_t size, const ch
{
struct stat stb;
int rt = 0;
- int t0 = GDKms();
+ lng t0 = GDKusec();
assert(!GDKinmemory(0));
#ifdef __COVERITY__
@@ -397,9 +398,9 @@ GDKextendf(int fd, size_t size, const ch
GDKsyserror("ftruncate to old size");
}
}
- TRC_DEBUG(IO_, "GDKextend %s %zu -> %zu %dms%s\n",
+ TRC_DEBUG(IO_, "GDKextend %s %zu -> %zu "LLFMT" usec%s\n",
fn, (size_t) stb.st_size, size,
- GDKms() - t0, rt != 0 ? " (failed)" : "");
+ GDKusec() - t0, rt != 0 ? " (failed)" : "");
/* posix_fallocate returns != 0 on failure, fallocate and
* ftruncate return -1 on failure, but all three return 0 on
* success */
diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c
--- a/gdk/gdk_system.c
+++ b/gdk/gdk_system.c
@@ -842,6 +842,7 @@ MT_thread_add_mylock(MT_Lock *lock)
struct posthread *p = pthread_getspecific(threadkey);
if (p) {
+ if (p == &mainthread) fprintf(stderr, "add %s\n", lock->name);
lock->nxt = p->mylocks;
p->mylocks = lock;
}
@@ -855,6 +856,7 @@ MT_thread_del_mylock(MT_Lock *lock)
struct posthread *p = pthread_getspecific(threadkey);
if (p) {
+ if (p == &mainthread) fprintf(stderr, "del %s\n", lock->name);
if (p->mylocks == lock) {
p->mylocks = lock->nxt;
} else {
diff --git a/sql/backends/monet5/vaults/fits/fits.c
b/sql/backends/monet5/vaults/fits/fits.c
--- a/sql/backends/monet5/vaults/fits/fits.c
+++ b/sql/backends/monet5/vaults/fits/fits.c
@@ -186,7 +186,7 @@ str FITSexportTable(Client cntxt, MalBlk
long optimal; /* type long used by fits library */
rids * rs;
- int tm0, texportboolean=0, texportchar=0, texportstring=0,
texportshort=0, texportint=0, texportlng=0, texportfloat=0, texportdouble=0;
+ lng tm0, texportboolean=0, texportchar=0, texportstring=0,
texportshort=0, texportint=0, texportlng=0, texportfloat=0, texportdouble=0;
size_t numberrow = 0, dimension = 0;
int cc = 0, status = 0, j = 0, columns, *fid, block = 0;
int boolcols = 0, charcols = 0, strcols = 0, shortcols = 0, intcols =
0, lngcols = 0, floatcols = 0, doublecols = 0;
@@ -315,17 +315,17 @@ str FITSexportTable(Client cntxt, MalBlk
if (dimension == (size_t) optimal)
{
dimension = 0;
- tm0 = GDKms();
+ tm0 = GDKusec();
fits_write_col(fptr, TLOGICAL, cc+1,
(optimal*block)+1, 1, optimal, readboolrows, &status);
- texportboolean += GDKms() - tm0;
+ texportboolean += GDKusec() - tm0;
GDKfree(readboolrows);
readboolrows = (_Bool *) GDKmalloc
(sizeof(_Bool) * optimal);
block++;
}
}
- tm0 = GDKms();
+ tm0 = GDKusec();
fits_write_col(fptr, TLOGICAL, cc+1, (optimal*block)+1,
1, dimension, readboolrows, &status);
- texportboolean += GDKms() - tm0;
+ texportboolean += GDKusec() - tm0;
GDKfree(readboolrows);
}
@@ -345,17 +345,17 @@ str FITSexportTable(Client cntxt, MalBlk
if (dimension == (size_t) optimal)
{
dimension = 0;
- tm0 = GDKms();
+ tm0 = GDKusec();
fits_write_col(fptr, TBYTE, cc+1,
(optimal*block)+1, 1, optimal, readcharrows, &status);
- texportchar += GDKms() - tm0;
+ texportchar += GDKusec() - tm0;
GDKfree(readcharrows);
readcharrows = (char *) GDKmalloc
(sizeof(char) * optimal);
block++;
}
}
- tm0 = GDKms();
+ tm0 = GDKusec();
fits_write_col(fptr, TBYTE, cc+1, (optimal*block)+1, 1,
dimension, readcharrows, &status);
- texportchar += GDKms() - tm0;
+ texportchar += GDKusec() - tm0;
GDKfree(readcharrows);
}
@@ -374,9 +374,9 @@ str FITSexportTable(Client cntxt, MalBlk
if (dimension == (size_t) optimal)
{
dimension = 0;
- tm0 = GDKms();
+ tm0 = GDKusec();
fits_write_col_str(fptr, cc+1,
(optimal*block)+1, 1, optimal, readstrrows, &status);
- texportstring += GDKms() - tm0;
+ texportstring += GDKusec() - tm0;
for (dimension = 0; dimension <
(size_t) optimal; dimension++)
GDKfree(readstrrows[dimension]);
dimension = 0;
@@ -385,9 +385,9 @@ str FITSexportTable(Client cntxt, MalBlk
block++;
}
}
- tm0 = GDKms();
+ tm0 = GDKusec();
fits_write_col_str(fptr, cc+1, (optimal*block)+1, 1,
dimension, readstrrows, &status);
- texportstring += GDKms() - tm0;
+ texportstring += GDKusec() - tm0;
for (numberrow = 0; numberrow < dimension; numberrow++)
GDKfree(readstrrows[numberrow]);
GDKfree(readstrrows);
@@ -409,17 +409,17 @@ str FITSexportTable(Client cntxt, MalBlk
if (dimension == (size_t) optimal)
{
dimension = 0;
- tm0 = GDKms();
+ tm0 = GDKusec();
fits_write_col(fptr, TSHORT, cc+1,
(optimal*block)+1, 1, optimal, readshortrows, &status);
- texportshort += GDKms() - tm0;
+ texportshort += GDKusec() - tm0;
GDKfree(readshortrows);
readshortrows = (short *) GDKmalloc
(sizeof(short) * optimal);
block++;
}
}
- tm0 = GDKms();
+ tm0 = GDKusec();
fits_write_col(fptr, TSHORT, cc+1, (optimal*block)+1,
1, dimension, readshortrows, &status);
- texportshort += GDKms() - tm0;
+ texportshort += GDKusec() - tm0;
GDKfree(readshortrows);
}
@@ -439,17 +439,17 @@ str FITSexportTable(Client cntxt, MalBlk
if (dimension == (size_t) optimal)
{
dimension = 0;
- tm0 = GDKms();
+ tm0 = GDKusec();
fits_write_col(fptr, TINT, cc+1,
(optimal*block)+1, 1, optimal, readintrows, &status);
- texportint += GDKms() - tm0;
+ texportint += GDKusec() - tm0;
GDKfree(readintrows);
readintrows = (int *) GDKmalloc
(sizeof(int) * optimal);
block++;
}
}
- tm0 = GDKms();
+ tm0 = GDKusec();
fits_write_col(fptr, TINT, cc+1, (optimal*block)+1, 1,
dimension, readintrows, &status);
- texportint += GDKms() - tm0;
+ texportint += GDKusec() - tm0;
GDKfree(readintrows);
}
@@ -469,17 +469,17 @@ str FITSexportTable(Client cntxt, MalBlk
if (dimension == (size_t) optimal)
{
dimension = 0;
- tm0 = GDKms();
+ tm0 = GDKusec();
fits_write_col(fptr, TLONG, cc+1,
(optimal*block)+1, 1, optimal, readlngrows, &status);
- texportlng += GDKms() - tm0;
+ texportlng += GDKusec() - tm0;
GDKfree(readlngrows);
readlngrows = (lng *) GDKmalloc
(sizeof(lng) * optimal);
block++;
}
}
- tm0 = GDKms();
+ tm0 = GDKusec();
fits_write_col(fptr, TLONG, cc+1, (optimal*block)+1, 1,
dimension, readlngrows, &status);
- texportlng += GDKms() - tm0;
+ texportlng += GDKusec() - tm0;
GDKfree(readlngrows);
}
@@ -499,17 +499,17 @@ str FITSexportTable(Client cntxt, MalBlk
if (dimension == (size_t) optimal)
{
dimension = 0;
- tm0 = GDKms();
+ tm0 = GDKusec();
fits_write_col(fptr, TFLOAT, cc+1,
(optimal*block)+1, 1, optimal, readfloatrows, &status);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]