diff options
author | Ben Cheng <bccheng@google.com> | 2009-09-14 16:00:41 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2009-09-14 16:00:41 -0700 |
commit | 5a4eb4eb367eccd4b976d1feae96cea96d2c50f2 (patch) | |
tree | 48df6856be9cb61d09a63d04cb6195c3855ed167 /libdb | |
parent | 9eda82a51a8ecbd15c9f76b8e191341df55861b8 (diff) | |
download | oprofile-5a4eb4eb367eccd4b976d1feae96cea96d2c50f2.tar.gz |
Refresh OProfile code running on the target side to 0.9.5 for ARMV7.
Diffstat (limited to 'libdb')
-rw-r--r-- | libdb/db_insert.c | 13 | ||||
-rw-r--r-- | libdb/db_manage.c | 6 | ||||
-rw-r--r-- | libdb/odb.h | 16 |
3 files changed, 29 insertions, 6 deletions
diff --git a/libdb/db_insert.c b/libdb/db_insert.c index 018c294..6bbd71f 100644 --- a/libdb/db_insert.c +++ b/libdb/db_insert.c @@ -51,6 +51,13 @@ static inline int add_node(odb_data_t * data, odb_key_t key, odb_value_t value) int odb_update_node(odb_t * odb, odb_key_t key) { + return odb_update_node_with_offset(odb, key, 1); +} + +int odb_update_node_with_offset(odb_t * odb, + odb_key_t key, + unsigned long int offset) +{ odb_index_t index; odb_node_t * node; odb_data_t * data; @@ -60,8 +67,8 @@ int odb_update_node(odb_t * odb, odb_key_t key) while (index) { node = &data->node_base[index]; if (node->key == key) { - if (node->value + 1 != 0) { - node->value += 1; + if (node->value + offset != 0) { + node->value += offset; } else { /* post profile tools must handle overflow */ /* FIXME: the tricky way will be just to add @@ -92,7 +99,7 @@ int odb_update_node(odb_t * odb, odb_key_t key) index = node->next; } - return add_node(data, key, 1); + return add_node(data, key, offset); } diff --git a/libdb/db_manage.c b/libdb/db_manage.c index d8a6fcb..17a0be5 100644 --- a/libdb/db_manage.c +++ b/libdb/db_manage.c @@ -11,10 +11,10 @@ #define _GNU_SOURCE #include <stdlib.h> -#ifndef ANDROID -#include <sys/fcntl.h> -#else +#ifdef ANDROID #include <fcntl.h> +#else +#include <sys/fcntl.h> #endif #include <sys/mman.h> #include <sys/types.h> diff --git a/libdb/odb.h b/libdb/odb.h index c190b57..9ad1da2 100644 --- a/libdb/odb.h +++ b/libdb/odb.h @@ -180,6 +180,22 @@ void odb_hash_free_stat(odb_hash_stat_t * stats); */ int odb_update_node(odb_t * odb, odb_key_t key); +/** + * odb_update_node_with_offset + * @param odb the data base object to setup + * @param key the hash key + * @param offset the offset to be added + * + * update info at key by adding the specified offset to its associated value, + * if the key does not exist a new node is created and the value associated + * is set to offset. + * + * returns EXIT_SUCCESS on success, EXIT_FAILURE on failure + */ +int odb_update_node_with_offset(odb_t * odb, + odb_key_t key, + unsigned long int offset); + /** Add a new node w/o regarding if a node with the same key already exists * * returns EXIT_SUCCESS on success, EXIT_FAILURE on failure |