db_insert.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "odb.h"
Include dependency graph for db_insert.c:

Go to the source code of this file.

Defines

#define _GNU_SOURCE

Functions

static 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)
int odb_update_node_with_offset (odb_t *odb, odb_key_t key, unsigned long int offset)
int odb_add_node (odb_t *odb, odb_key_t key, odb_value_t value)

Detailed Description

Inserting a key-value pair into a DB

Remarks:
Copyright 2002 OProfile authors
Read the file COPYING
Author:
Philippe Elie

Definition in file db_insert.c.


Define Documentation

#define _GNU_SOURCE

Definition at line 11 of file db_insert.c.


Function Documentation

static int add_node ( odb_data_t data,
odb_key_t  key,
odb_value_t  value 
) [inline, static]

Definition at line 21 of file db_insert.c.

References odb_descr_t::current_size, odb_data::descr, odb_data::hash_base, odb_node_t::key, odb_node_t::next, odb_data::node_base, odb_commit_reservation(), odb_do_hash(), odb_grow_hashtable(), odb_descr_t::size, and odb_node_t::value.

Referenced by odb_add_node(), and odb_update_node_with_offset().

Here is the call graph for this function:

Here is the caller graph for this function:

int odb_add_node ( odb_t odb,
odb_key_t  key,
odb_value_t  value 
)

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

Definition at line 106 of file db_insert.c.

References add_node(), and odb_t::data.

Referenced by import_from_abi(), and main().

Here is the call graph for this function:

Here is the caller graph for this function:

int odb_update_node ( odb_t odb,
odb_key_t  key 
)

update info at key by incrementing its associated value by one, if the key does not exist a new node is created and the value associated is set to one.

returns EXIT_SUCCESS on success, EXIT_FAILURE on failure

Definition at line 52 of file db_insert.c.

References odb_update_node_with_offset().

Referenced by opd_put_image_sample(), operf_sfile_log_arc(), sfile_log_arc(), speed_test(), and test().

Here is the call graph for this function:

Here is the caller graph for this function:

int odb_update_node_with_offset ( odb_t odb,
odb_key_t  key,
unsigned long int  offset 
)

odb_update_node_with_offset

Parameters:
odb the data base object to setup
key the hash key
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

Definition at line 57 of file db_insert.c.

References add_node(), odb_t::data, odb_data::hash_base, odb_node_t::key, odb_node_t::next, odb_data::node_base, odb_do_hash(), and odb_node_t::value.

Referenced by odb_update_node(), operf_sfile_log_sample_count(), and sfile_log_sample_count().

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1