From: Philippe E. <ph...@us...> - 2002-04-19 15:08:13
|
Update of /cvsroot/oprofile/oprofile/libdb In directory usw-pr-cvs1:/tmp/cvs-serv17737/libdb Modified Files: Tag: branch-db-1 db-manage.c db.h Log Message: enable using db for samples files, first overhead test show good results. first line for each sampling rate is the old implementation, second is with db # real user system # kernel-compile-300000.20020419-152253.out (3 run) 2 501.74 (1.39%) 457.55 (1.04%) 42.99 (2.99%) 2 500.51 (1.33%) 455.62 (0.59%) 43.17 (5.47%) # kernel-compile-100000.20020419-152253.out (3 run) 3 507.51 (2.55%) 460.77 (1.75%) 44.56 (6.76%) 3 508.22 (2.89%) 462.15 (2.04%) 42.03 (2.69%) # kernel-compile-25000.20020419-152253.out (3 run) 4 531.26 (7.35%) 481.61 (6.35%) 44.72 (7.14%) 4 536.16 (8.55%) 479.16 (5.79%) 44.95 (9.82%) Same thing for the du -h result 11M /var/opd/samples/session-300000.20020419-161018 2.9M /var/opd/samples/session-300000.20020419-152253 11M /var/opd/samples/session-100000.20020419-161018 3.1M /var/opd/samples/session-100000.20020419-152253 17M /var/opd/samples/session-25000.20020419-161018 3.9M /var/opd/samples/session-25000.20020419-152253 Phil Index: db-manage.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/libdb/Attic/db-manage.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -d -r1.1.2.1 -r1.1.2.2 --- db-manage.c 19 Apr 2002 01:02:00 -0000 1.1.2.1 +++ db-manage.c 19 Apr 2002 15:01:03 -0000 1.1.2.2 @@ -118,6 +118,7 @@ fprintf(stderr, "unable to resize file %s to %d " "length, cause : %s\n", filename, file_size, strerror(errno)); + exit(EXIT_FAILURE); } } else { nr_page = (stat_buf.st_size - tree->offset_page) / sizeof(db_page_t); @@ -153,7 +154,7 @@ void db_close(db_tree_t * tree) { - if (tree->page_base) + if (tree->base_memory) munmap(tree->base_memory, (tree->descr->size * sizeof(db_page_t)) + tree->offset_page); @@ -161,3 +162,12 @@ close(tree->fd); } +void db_sync(db_tree_t * tree) +{ + if (tree->base_memory) { + msync(tree->base_memory, + tree->offset_page + + (tree->descr->current_size * sizeof(db_page_t)), + MS_ASYNC); + } +} Index: db.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/libdb/Attic/db.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -u -d -r1.1.2.1 -r1.1.2.2 --- db.h 19 Apr 2002 01:02:02 -0000 1.1.2.1 +++ db.h 19 Apr 2002 15:01:03 -0000 1.1.2.2 @@ -100,6 +100,9 @@ */ void db_close(db_tree_t * tree); +/** issue a msync on the used size of the mmaped file */ +void db_sync(db_tree_t * tree); + /** add a page returning its index. Take care all page pointer can be * invalidated by this call ! */ db_page_idx_t db_add_page(db_tree_t * tree); |