- Complete libnode.c LibLog support,

- Complete ndbench.c LibLog support,
- Add test-10M.ndb & test-10M-s.ndb test files.
This commit is contained in:
Arnaud G. GIBERT 2024-04-21 12:54:13 +02:00
parent 67e20bbd87
commit 27f401dff6
6 changed files with 214 additions and 113 deletions

View File

@ -370,13 +370,13 @@ NDT_Status ND_Default_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT
default:
{
printf( "ND_Default_Manager() called with an undefined command %d\n", Command);
return(NDS_ERRAPI);
LG_LOG_ERROR_1( "Manager called with an undefined command: (%d)", Command);
return( NDS_ERRAPI);
}
}
printf( "ND_Default_Manager() called with command %d (%s)\n", Command, Command_Name);
return(NDS_OK);
LG_LOG_ERROR_2( "Manager internal error with command: (%d) name: [%s]", Command, Command_Name);
return( NDS_OK);
}
@ -519,7 +519,7 @@ NDT_Status ND_OpenStruct_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id,
default:
{
printf( "Unknown COMP idx (%d) !\n", Index_Id);
LG_LOG_ERROR_1( "Unknown COMP idx: (%d)", Index_Id);
return( NDS_KO);
}
}
@ -636,12 +636,12 @@ NDT_Status ND_OpenStruct_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id,
default:
{
printf( "OpenStruct_Manager() called with an undefined command %d\n", Command);
LG_LOG_ERROR_1( "Manager called with an undefined command: (%d)", Command);
return( NDS_ERRAPI);
}
}
printf( "OpenStruct_Manager() called with command %d (%s)\n", Command, Command_Name);
LG_LOG_ERROR_2( "Manager internal error with command: (%d) name: [%s]", Command, Command_Name);
return( NDS_OK);
}
@ -1367,11 +1367,11 @@ NDT_Status ND_Index_Check_I( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int
if( *Detected_Nb_Ptr == 0)
{
fprintf( Out, "No error detected in the node structure (%p:%d)\n", Root_Ptr, Index_Id);
LG_LOG_INFO_2( "No error detected in the node structure (%p:%d)", Root_Ptr, Index_Id);
}
else
{
fprintf( Out, "%d/%d error(s) corrected in the node structure (%p:%d)\n", *Corrected_Nb_Ptr, *Detected_Nb_Ptr, Root_Ptr, Index_Id);
LG_LOG_INFO_4( "%d/%d error(s) corrected in the node structure (%p:%d)\n", *Corrected_Nb_Ptr, *Detected_Nb_Ptr, Root_Ptr, Index_Id);
}
}
@ -2616,8 +2616,8 @@ NDT_Status ND_Index_Node_Add_I( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, ND
else if( ND_INDEX_TYPE_TREE_IS( Root_Ptr, Index_Id)) return ND_Tree_Node_Add( Root_Ptr, Index_Id, Node_Ptr);
else
{
sprintf (NDG_Base.Err_String, "Error ND_Index_Node_Add_I: unknown structure type (%d)", Root_Ptr->Index_Tab[Index_Id].Type);
ND_Error_Print ();
LG_LOG_ERROR_1( "Unknown structure type (%d)", Root_Ptr->Index_Tab[Index_Id].Type);
return( NDS_ERRAPI);
}
@ -2741,8 +2741,8 @@ NDT_Status ND_Index_Node_Remove_I( NDT_Node *Node_Ptr)
}
else
{
sprintf (NDG_Base.Err_String, "Error ND_Index_Node_Remove_I: unknown structure type (%d)", root_ptr->Index_Tab[index_id].Type);
ND_Error_Print ();
LG_LOG_ERROR_1( "Unknown structure type (%d)", root_ptr->Index_Tab[index_id].Type);
return(NDS_ERRAPI);
}
@ -2986,8 +2986,7 @@ NDT_Status ND_Index_Node_Find_VI( NDT_Node **Node_Ptr_Ptr, NDT_Root *Root_Ptr
}
else
{
sprintf (NDG_Base.Err_String, "Error ND_Index_Node_Find_VI: unknown structure type (%d)", Root_Ptr->Index_Tab[Index_Id].Type);
ND_Error_Print ();
LG_LOG_ERROR_1( "Unknown structure type (%d)", Root_Ptr->Index_Tab[Index_Id].Type);
return( NDS_KO);
}
@ -3040,7 +3039,8 @@ NDT_Status ND_Index_Node_Find_VC( NDT_Node **Node_Ptr_Ptr, NDT_Root *Root_Ptr
NDT_Status ND_Index_Node_Find_I( NDT_Node **Node_Ptr_Ptr, NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, void *Value_Ptr, ...)
{
va_list user_args;
va_list user_args;
NDT_Status status;
va_start( user_args, Value_Ptr);
@ -3048,20 +3048,22 @@ NDT_Status ND_Index_Node_Find_I( NDT_Node **Node_Ptr_Ptr, NDT_Root *Root_Ptr,
if( ND_INDEX_TYPE_LIST_IS( Root_Ptr, Index_Id))
{
*Node_Ptr_Ptr = ND_List_Node_Find( Root_Ptr, Index_Id, Value_Ptr, &user_args);
status = NDS_OK;
}
else if ( ND_INDEX_TYPE_TREE_IS( Root_Ptr, Index_Id))
{
*Node_Ptr_Ptr = ND_Tree_Node_Find( Root_Ptr, Index_Id, Value_Ptr, &user_args);
status = NDS_OK;
}
else
{
sprintf (NDG_Base.Err_String, "Error ND_Index_Node_Find_I: unknown structure type (%d)", Root_Ptr->Index_Tab[Index_Id].Type);
ND_Error_Print ();
LG_LOG_ERROR_1( "Unknown structure type (%d)", Root_Ptr->Index_Tab[Index_Id].Type);
status = NDS_KO;
}
va_end( user_args);
return( NDS_OK);
return( status);
}
@ -4039,7 +4041,8 @@ NDT_Status ND_List_Node_Add( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_N
}
}
printf( "ND_List_Node_Add: unknown list type (%d)\n", Root_Ptr->Index_Tab[Index_Id].Type);
LG_LOG_ERROR_1( "Unknown list type: (%d)", Root_Ptr->Index_Tab[Index_Id].Type);
return( NDS_ERRAPI);
}
@ -4911,7 +4914,9 @@ void ND_List_Link_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_D
if( left2right_node_number == right2left_node_number)
{
Root_Ptr->Index_Tab[Index_Id].Node_Number = left2right_node_number;
fprintf( Out, "\t- number of node has been corrected on structure %p:%d\n", Root_Ptr, Index_Id);
LG_LOG_WARNING_2( "\t- number of node has been corrected on structure: (%p:%d)", Root_Ptr, Index_Id);
(*Nb_Detected_Ptr)++;
(*Nb_Corrected_Ptr)++;
return;
@ -4927,7 +4932,8 @@ void ND_List_Link_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_D
{
if( node_ptr->Right && ( node_ptr->Right->Left != node_ptr))
{
fprintf( Out, "\t- link 'Left' has been corrected on node %p of structure %p:%d\n", node_ptr->Right, Root_Ptr, Index_Id);
LG_LOG_WARNING_3( "\t- link 'Left' has been corrected on node: (%p) of structure: (%p:%d)", node_ptr->Right, Root_Ptr, Index_Id);
node_ptr->Right->Left = node_ptr;
(*Nb_Detected_Ptr)++;
(*Nb_Corrected_Ptr)++;
@ -4935,7 +4941,8 @@ void ND_List_Link_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_D
if( !node_ptr->Right && ( node_ptr != Root_Ptr->Index_Tab[Index_Id].Tail))
{
fprintf( Out, "\t- link 'Tail' has been corrected on structure %p:%d\n", Root_Ptr, Index_Id);
LG_LOG_WARNING_2( "\t- link 'Tail' has been corrected on structure: (%p:%d)", Root_Ptr, Index_Id);
Root_Ptr->Index_Tab[Index_Id].Tail = node_ptr;
(*Nb_Detected_Ptr)++;
(*Nb_Corrected_Ptr)++;
@ -4946,7 +4953,8 @@ void ND_List_Link_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_D
if( Root_Ptr->Index_Tab[Index_Id].Node_Number != left2right_node_number)
{
fprintf( Out, "\t- number of node has been corrected on structure %p:%d\n", Root_Ptr, Index_Id);
LG_LOG_WARNING_2( "\t- number of node has been corrected on structure: (%p:%d)", Root_Ptr, Index_Id);
Root_Ptr->Index_Tab[Index_Id].Node_Number = left2right_node_number;
(*Nb_Detected_Ptr)++;
(*Nb_Corrected_Ptr)++;
@ -4965,7 +4973,8 @@ void ND_List_Link_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_D
{
if( node_ptr->Left && ( node_ptr->Left->Right != node_ptr))
{
fprintf( Out, "\t- link 'Right' has been corrected on node %p of list %p:%d\n", node_ptr->Left, Root_Ptr, Index_Id);
LG_LOG_WARNING_3( "\t- link 'Right' has been corrected on node: (%p) of list: (%p:%d)", node_ptr->Left, Root_Ptr, Index_Id);
node_ptr->Left->Right = node_ptr;
(*Nb_Detected_Ptr)++;
(*Nb_Corrected_Ptr)++;
@ -4973,7 +4982,8 @@ void ND_List_Link_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_D
if( !node_ptr->Left && ( node_ptr != Root_Ptr->Index_Tab[Index_Id].Head))
{
fprintf( Out, "\t- link 'Head' has been corrected on the structure root %p:%d\n", Root_Ptr, Index_Id);
LG_LOG_WARNING_2( "\t- link 'Head' has been corrected on the structure root: (%p:%d)", Root_Ptr, Index_Id);
Root_Ptr->Index_Tab[Index_Id].Head = node_ptr;
(*Nb_Detected_Ptr)++;
(*Nb_Corrected_Ptr)++;
@ -4984,7 +4994,8 @@ void ND_List_Link_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_D
if( Root_Ptr->Index_Tab[Index_Id].Node_Number != right2left_node_number)
{
fprintf( Out, "\t- number of node has been corrected on structure %p:%d\n", Root_Ptr, Index_Id);
LG_LOG_WARNING_2( "\t- number of node has been corrected on structure: (%p:%d)", Root_Ptr, Index_Id);
Root_Ptr->Index_Tab[Index_Id].Node_Number = right2left_node_number;
(*Nb_Detected_Ptr)++;
(*Nb_Corrected_Ptr)++;
@ -5015,7 +5026,7 @@ void ND_Value_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_Dete
if( !node_ptr->Value)
{
fprintf( Out, "\t- node %p has been removed from structure %p:%d because no value is attached to it\n", node_ptr, Root_Ptr, Index_Id);
LG_LOG_WARNING_3( "\t- node: (%p) has been removed from structure (%p:%d) because no value is attached to it", node_ptr, Root_Ptr, Index_Id);
ND_Index_Node_Remove_I( node_ptr);
@ -5026,7 +5037,7 @@ void ND_Value_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_Dete
}
else if( ND_Address_Check( node_ptr->Value) != NDS_OK)
{
fprintf (Out, "\t- node %p has been removed from structure %p:%d because its value cannot be accessed\n", node_ptr, Root_Ptr, Index_Id);
LG_LOG_WARNING_3( "\t- node %p has been removed from structure %p:%d because its value cannot be accessed", node_ptr, Root_Ptr, Index_Id);
ND_Index_Node_Remove_I( node_ptr);
@ -5080,7 +5091,9 @@ void ND_Tree_Link_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_
if( Root_Ptr->Index_Tab[Index_Id].Head->Root != Root_Ptr)
{
Root_Ptr->Index_Tab[Index_Id].Head->Root = Root_Ptr;
fprintf( Out, "\t- link 'Root' has been corrected on node %p of structure %p:%d\n", Root_Ptr->Index_Tab[Index_Id].Head, Root_Ptr, Index_Id);
LG_LOG_WARNING_3( "\t- link 'Root' has been corrected on node: (%p) of structure: (%p:%d)", Root_Ptr->Index_Tab[Index_Id].Head, Root_Ptr, Index_Id);
(*Nb_Detected_Ptr)++;
(*Nb_Corrected_Ptr)++;
}
@ -5103,7 +5116,9 @@ void ND_Tree_Link_Check( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, int *Nb_
if( ND_Index_Node_Find_I( &node_ptr, Root_Ptr, Index_Id, Root_Ptr->Index_Tab[Index_Id].Save->Value, NULL) != NDS_OK)
{
ND_Index_Node_Add_I( Root_Ptr, Index_Id, Root_Ptr->Index_Tab[Index_Id].Save);
fprintf( Out, "\t- saved node %p has been restored to structure %p:%d\n", Root_Ptr->Index_Tab[Index_Id].Save, Root_Ptr, Index_Id);
LG_LOG_WARNING_3( "\t- saved node: (%p) has been restored to structure: (%p:%d)", Root_Ptr->Index_Tab[Index_Id].Save, Root_Ptr, Index_Id);
(*Nb_Detected_Ptr)++;
(*Nb_Corrected_Ptr)++;
}
@ -5123,7 +5138,9 @@ void ND_Tree_Link_Recursive_Check( NDT_Node *Node_Ptr, int *Nb_Detected_Ptr,
if( Node_Ptr->Left->Root != Node_Ptr->Root)
{
Node_Ptr->Left->Root = Node_Ptr->Root;
fprintf( Out, "\t- link 'Root' has been corrected on node %p of structure %p:%d\n", Node_Ptr->Left, Node_Ptr->Root, Node_Ptr->Index);
LG_LOG_WARNING_3( "\t- link 'Root' has been corrected on node: (%p) of structure: (%p:%d)", Node_Ptr->Left, Node_Ptr->Root, Node_Ptr->Index);
(*Nb_Detected_Ptr)++;
(*Nb_Corrected_Ptr)++;
}
@ -5131,7 +5148,9 @@ void ND_Tree_Link_Recursive_Check( NDT_Node *Node_Ptr, int *Nb_Detected_Ptr,
if( Node_Ptr->Left->Parent != Node_Ptr)
{
Node_Ptr->Left->Parent = Node_Ptr;
fprintf( Out, "\t- link 'Parent' has been corrected on node %p of structure %p:%d\n", Node_Ptr->Left, Node_Ptr->Root, Node_Ptr->Index);
LG_LOG_WARNING_3( "\t- link 'Parent' has been corrected on node: (%p) of structure: (%p:%d)", Node_Ptr->Left, Node_Ptr->Root, Node_Ptr->Index);
(*Nb_Detected_Ptr)++;
(*Nb_Corrected_Ptr)++;
}
@ -5146,7 +5165,9 @@ void ND_Tree_Link_Recursive_Check( NDT_Node *Node_Ptr, int *Nb_Detected_Ptr,
if( Node_Ptr->Right->Root != Node_Ptr->Root)
{
Node_Ptr->Right->Root = Node_Ptr->Root;
fprintf( Out, "\t- link 'Root' has been corrected on node %p of structure %p:%d\n", Node_Ptr->Right, Node_Ptr->Root, Node_Ptr->Index);
LG_LOG_WARNING_3( "\t- link 'Root' has been corrected on node: (%p) of structure: (%p:%d)", Node_Ptr->Right, Node_Ptr->Root, Node_Ptr->Index);
(*Nb_Detected_Ptr)++;
(*Nb_Corrected_Ptr)++;
}
@ -5154,7 +5175,9 @@ void ND_Tree_Link_Recursive_Check( NDT_Node *Node_Ptr, int *Nb_Detected_Ptr,
if( Node_Ptr->Right->Parent != Node_Ptr)
{
Node_Ptr->Right->Parent = Node_Ptr;
fprintf( Out, "\t- link 'Parent' has been corrected on node %p of structure %p:%d\n", Node_Ptr->Right, Node_Ptr->Root, Node_Ptr->Index);
LG_LOG_WARNING_3( "\t- link 'Parent' has been corrected on node: (%p) of structure: (%p:%d)", Node_Ptr->Right, Node_Ptr->Root, Node_Ptr->Index);
(*Nb_Detected_Ptr)++;
(*Nb_Corrected_Ptr)++;
}
@ -5304,16 +5327,3 @@ void ND_Signal_Trap( int Sig_Num)
longjmp( NDG_Base.SigLongJmp_Env, 1);
#endif
}
/*------------------------------------------------------------------------------*/
/* Routine d'affichage d'un message d'erreur */
/*------------------------------------------------------------------------------*/
void ND_Error_Print( void)
{
if( NDG_Base.Err_Stream) fprintf( ( NDG_Base.Err_Stream == (FILE *)-1 ) ? stderr : NDG_Base.Err_Stream, "%s\n", NDG_Base.Err_String);
}

View File

@ -353,8 +353,6 @@ void ND_Tree_Link_Recursive_Check( NDT_Node *, int *, int *, FILE *);
NDT_Status ND_Symbol_Find( void **, const char *);
void ND_Error_Print( void);
void ND_Signal_Trap( int);
NDT_Status ND_Address_Check( void *);

View File

@ -43,6 +43,9 @@
# include <ver.h>
#endif
#include <log.h>
#include <node.h>
@ -51,6 +54,10 @@
/* Defines */
/*----------------------------------------------------------------------------*/
#define LGD_MODULE_NAME "ndb"
#ifdef _LIBVER_SUPPORT
//VER_INFO_EXPORT( ndbench, "$Revision: 2.10 $", "$Name: $", __FILE__, "$Author: agibert $");
# define USAGE "Usage : %s [ --help | --version [-v] | --batch_run <batch_file_name>]\n"
@ -58,8 +65,6 @@
# define USAGE "Usage : %s [ --help | --batch_run <batch_file_name>]\n"
#endif
#include <node.h>
#define QUIT 0
@ -278,6 +283,7 @@ NDT_Status Module_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Nod
ND_VA_ARG_GET( Cmd, *Args_Ptr, NDT_Command);
ND_VA_ARG_GET( Value_Ptr, *Args_Ptr, void *);
*/
ND_VA_ARG_GET( Reply_Index_Id_Ptr, *Args_Ptr, NDT_Index_Id *);
ND_VA_ARG_GET( Reply_Command_Ptr, *Args_Ptr, NDT_Command *);
ND_VA_ARG_GET( Cmd, *Args_Ptr, NDT_Command);
@ -321,6 +327,7 @@ NDT_Status Module_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Nod
ND_VA_LIST_CLOSE( user_args);
*/
ND_VA_ARG_GET( Module_Ptr_Ptr, *Args_Ptr, T_Module **);
ND_VA_LIST_OPEN( user_args, *Args_Ptr);
@ -359,6 +366,7 @@ NDT_Status Module_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Nod
ND_VA_LIST_CLOSE( user_args);
*/
ND_VA_ARG_GET( Module_Ptr, *Args_Ptr, T_Module *);
@ -384,6 +392,7 @@ NDT_Status Module_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Nod
ND_VA_LIST_CLOSE( user_args);
*/
ND_VA_ARG_GET( Module1_Ptr, *Args_Ptr, T_Module *);
ND_VA_ARG_GET( Module2_Ptr, *Args_Ptr, T_Module *);
@ -481,6 +490,7 @@ NDT_Status Module_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Nod
void *Value_Ptr = Node_Ptr->Value;
*/
ND_VA_ARG_GET( Next_Node_Ptr, *Args_Ptr, NDT_Node *);
ND_VA_LIST_OPEN( lib_args, *Args_Ptr);
@ -668,8 +678,9 @@ void Command_Get( int *choice, char **arg1, char **arg2, FILE *File_Output,
void Command_Exec_Begin_Print( FILE *File_Output, int Choice)
{
fprintf( File_Output, "%s: %s...\n", Command_Tab[Choice].Name, Command_Tab[Choice].FullName);
fflush( File_Output);
// fprintf( File_Output, "%s: %s...\n", Command_Tab[Choice].Name, Command_Tab[Choice].FullName);
LG_LOG_INFO_2( "%s: %s...", Command_Tab[Choice].Name, Command_Tab[Choice].FullName);
// fflush( File_Output);
}
@ -677,18 +688,20 @@ void Command_Exec_Begin_Print( FILE *File_Output, int Choice)
/*----------------------------------------------------------------------------*/
/* Command_Exec_En_Print */
/* Command_Exec_End_Print */
/*----------------------------------------------------------------------------*/
void Command_Exec_End_Print( FILE *File_Output, int Choice, cpt T_Exec, int nb)
{
if( nb == 1)
{
fprintf( File_Output, "%s: Completed in (%.4f) second !\n", Command_Tab[Choice].Name, T_Exec.sec);
// fprintf( File_Output, "%s: Completed in (%.4f) second !\n", Command_Tab[Choice].Name, T_Exec.sec);
LG_LOG_INFO_2( "%s: Completed in (%.4f) second !", Command_Tab[Choice].Name, T_Exec.sec);
}
else
{
fprintf( File_Output, "%s: Completed in (%.4f) second, (%.2f) per second !\n", Command_Tab[Choice].Name, T_Exec.sec, nb / T_Exec.sec);
// fprintf( File_Output, "%s: Completed in (%.4f) second, (%.2f) per second !\n", Command_Tab[Choice].Name, T_Exec.sec, nb / T_Exec.sec);
LG_LOG_INFO_3( "%s: Completed in (%.4f) second, (%.2f) per second !", Command_Tab[Choice].Name, T_Exec.sec, nb / T_Exec.sec);
}
}
@ -746,13 +759,13 @@ void Command_Index_Range_Get( FILE *File_Output, int *Low, int *High, char
void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, char *Arg1, char *Arg2, FILE *File_Input)
{
int low, high, i, j, nb_removed, Nb_Detected, Nb_Corrected;
int sub_choice, low, high, i, j, nb_removed, Nb_Detected, Nb_Corrected;
T_Module Ref_Module, *Module_Ptr;
char buf[BUF_SIZE];
NDT_Index_Type index_subtype;
fprintf( File_Output, "\n");
// fprintf( File_Output, "\n");
switch( Choice)
{
@ -773,10 +786,10 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
Arg1 = buf;
}
Choice = atoi( Arg1);
sub_choice = atoi( Arg1);
t_start( t_exec);
ND_Library_Open( Choice);
ND_Library_Open( sub_choice);
t_stop( t_exec);
Command_Exec_End_Print( File_Output, Choice, t_exec, 1);
@ -807,7 +820,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
Arg1 = buf;
}
Choice = atoi( Arg1);
sub_choice = atoi( Arg1);
for( i = 0; i < INDEX_NB; i++)
{
@ -815,7 +828,7 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
}
t_start( t_exec);
if( Choice == 0)
if( sub_choice == 0)
{
ND_DataStruct_Open( DS_Ptr_Ptr, INDEX_NB, idx_type_tab, "Module_Manager", Module_Manager, NULL, NULL, NULL, NULL, NDD_TRUE, NULL);
}
@ -909,8 +922,11 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
order = atoi( Arg2);
fprintf( File_Output, "DS_Value_Add: Adding from: (%d) to: (%d) order: (%d)...\n", low, high, order);
fflush( File_Output);
// fprintf( File_Output, "DS_Value_Add: Adding from: (%d) to: (%d) order: (%d)...\n", low, high, order);
// fflush( File_Output);
LG_LOG_INFO_3( "DS_Value_Add: Adding from: (%d) to: (%d) order: (%d)...", low, high, order);
t_start( t_exec);
@ -927,7 +943,9 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
}
else
{
fprintf( File_Output, "DS_Value_Add: Allocation Failled !\n");
// fprintf( File_Output, "DS_Value_Add: Allocation Failled !\n");
LG_LOG_ERROR_0( "DS_Value_Add: Allocation Failled !");
break;
}
@ -947,7 +965,8 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
}
else
{
fprintf( File_Output, "DS_Value_Add: Allocation Failled !\n");
// fprintf( File_Output, "DS_Value_Add: Allocation Failled !\n");
LG_LOG_ERROR_0( "DS_Value_Add: Allocation Failled !");
break;
}
@ -1051,8 +1070,11 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
if( low != -1)
{
fprintf( File_Output, "DS_Value_Find: from: (%d) to: (%d)...\n", low, high);
fflush( File_Output);
// fprintf( File_Output, "DS_Value_Find: from: (%d) to: (%d)...\n", low, high);
// fflush( File_Output);
LG_LOG_INFO_2( "DS_Value_Find: from: (%d) to: (%d)...", low, high);
i = low;
j = high + 1;
@ -1080,8 +1102,10 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
if( low != -1)
{
fprintf( File_Output, "Index_List_Open: Opening a FIFO List from: (%d) to: (%d)...\n", low, high);
fflush( File_Output);
// fprintf( File_Output, "Index_List_Open: Opening a FIFO List from: (%d) to: (%d)...\n", low, high);
// fflush( File_Output);
LG_LOG_INFO_2( "Index_List_Open: Opening a FIFO List from: (%d) to: (%d)...", low, high);
t_start( t_exec);
@ -1104,9 +1128,10 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
if( low != -1)
{
// fprintf( File_Output, "Index_Tree_Open: Opening a balanced Tree from: (%d) to: (%d)...\n", low, high);
// fflush( File_Output);
fprintf( File_Output, "Index_Tree_Open: Opening a balanced Tree from: (%d) to: (%d)...\n", low, high);
fflush( File_Output);
LG_LOG_INFO_2( "Index_Tree_Open: Opening a balanced Tree from: (%d) to: (%d)...", low, high);
t_start( t_exec);
@ -1129,9 +1154,10 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
if( low != -1)
{
// fprintf( File_Output, "Index_Close: Closing index from: (%d) to: (%d)...\n", low, high);
// fflush( File_Output);
fprintf( File_Output, "Index_Close: Closing index from: (%d) to: (%d)...\n", low, high);
fflush( File_Output);
LG_LOG_INFO_2( "Index_Close: Closing index from: (%d) to: (%d)...", low, high);
t_start( t_exec);
@ -1197,7 +1223,8 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
if( index_subtype != NDD_INDEX_SUBTYPE_UNKNOWN)
{
fprintf( File_Output, "Index_List_SubType_Set: Setting List SubType to: (%d) (%s) !\n", index_subtype, ND_INDEX_SUBTYPE_VALUE_ASCII_GET( index_subtype));
// fprintf( File_Output, "Index_List_SubType_Set: Setting List SubType to: (%d) (%s) !\n", index_subtype, ND_INDEX_SUBTYPE_VALUE_ASCII_GET( index_subtype));
LG_LOG_INFO_2( "Index_List_SubType_Set: Setting List SubType to: (%d) (%s) !", index_subtype, ND_INDEX_SUBTYPE_VALUE_ASCII_GET( index_subtype));
t_start( t_exec);
@ -1299,8 +1326,10 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
for( i = low; i <= high; i++)
{
fprintf( File_Output, "Index_Reorg: Reorganizing index (%d)...\n", i);
fflush( File_Output);
// fprintf( File_Output, "Index_Reorg: Reorganizing index (%d)...\n", i);
// fflush( File_Output);
LG_LOG_INFO_1( "Index_Reorg: Reorganizing index (%d)...", i);
ND_Index_Reorg( *DS_Ptr_Ptr, (NDT_Index_Id)i);
}
@ -1323,8 +1352,10 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
for( i = low; i <= high; i++)
{
fprintf( File_Output, "Index_Tree_To_List: Converting Index (%d)...\n", i);
fflush( File_Output);
// fprintf( File_Output, "Index_Tree_To_List: Converting Index (%d)...\n", i);
// fflush( File_Output);
LG_LOG_INFO_1( "Index_Tree_To_List: Converting Index (%d)...", i);
ND_Index_Convert( *DS_Ptr_Ptr, (NDT_Index_Id)i, idx_type_sorted_list);
}
@ -1347,8 +1378,10 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
for( i = low; i <= high; i++)
{
fprintf( File_Output, "Index_List_To_Tree: Converting Index (%d)...\n", i);
fflush( File_Output);
// fprintf( File_Output, "Index_List_To_Tree: Converting Index (%d)...\n", i);
// fflush( File_Output);
LG_LOG_INFO_1( "Index_List_To_Tree: Converting Index (%d)...", i);
ND_Index_Convert( *DS_Ptr_Ptr, (NDT_Index_Id)i, idx_type_balanced_tree);
}
@ -1367,8 +1400,10 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
if( low != -1)
{
fprintf( File_Output, "Index_Info_Print: Printing index from: (%d) to: (%d)...\n", low, high);
fflush( File_Output);
// fprintf( File_Output, "Index_Info_Print: Printing index from: (%d) to: (%d)...\n", low, high);
// fflush( File_Output);
LG_LOG_INFO_2( "Index_Info_Print: Printing index from: (%d) to: (%d)...", low, high);
for( i = low; i <= high; i++)
{
@ -1381,8 +1416,10 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
case INDEX_VALUE_PRINT:
{
fprintf( File_Output, "DS_Value_Print:\n");
fflush( File_Output);
// fprintf( File_Output, "DS_Value_Print:\n");
// fflush( File_Output);
LG_LOG_INFO_0( "DS_Value_Print:");
ND_DataStruct_Value_Print( File_Output, *DS_Ptr_Ptr, NDD_RECURSIVE_MODE_PARENT_CHILD, 99, 0);
break;
@ -1408,15 +1445,19 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
position = atoi( Arg2);
fprintf( File_Output, "Index_Value_Break: Breaking %s values from index : (%d) to: (%d)...\n",
// fprintf( File_Output, "Index_Value_Break: Breaking %s values from index : (%d) to: (%d)...\n",
// ( position == 0 ) ? "Head" : ( ( position == 1) ? "Tail" : "Random"),
// low, high);
// fflush( File_Output);
LG_LOG_INFO_3( "Index_Value_Break: Breaking: (%s) values from index: (%d) to: (%d)...",
( position == 0 ) ? "Head" : ( ( position == 1) ? "Tail" : "Random"),
low, high);
fflush( File_Output);
t_start( t_exec);
fprintf( File_Output, "Index_Value_Break: Breaking value of nodes: ");
fflush( File_Output);
// fprintf( File_Output, "Index_Value_Break: Breaking value of nodes: ");
// fflush( File_Output);
for( i = low; i <= high; i++)
{
@ -1447,8 +1488,10 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
}
}
fprintf( File_Output, "0x(%x)", node_ptr);
fflush( File_Output);
// fprintf( File_Output, "0x(%x)", node_ptr);
// fflush( File_Output);
LG_LOG_INFO_1( "Index_Value_Break: Breaking value of node: 0x(%x)", node_ptr);
node_ptr->Value = (void *)-1;
}
@ -1480,9 +1523,12 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
for( i = low; i <= high; i++)
{
fprintf( File_Output, "Index_Check: Checking Index (%d)...\n", i);
fprintf( File_Output, "Index_Check: ");
fflush( File_Output);
// fprintf( File_Output, "Index_Check: Checking Index (%d)...\n", i);
// fprintf( File_Output, "Index_Check: ");
// fflush( File_Output);
LG_LOG_INFO_1( "Index_Check: Checking Index (%d)...", i);
LG_LOG_INFO_0( "Index_Check: ");
Nb_Corrected = Nb_Detected = 0;
ND_Index_Check( *DS_Ptr_Ptr, (NDT_Index_Id)i, &Nb_Detected, &Nb_Corrected, File_Output);
@ -1514,15 +1560,21 @@ void Command_Exec( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, int Choice, cha
if( file_input == NULL)
{
fprintf( File_Output, "Batch_Run: Can't open file (%s)!\n", Arg1);
// fprintf( File_Output, "Batch_Run: Can't open file (%s)!\n", Arg1);
LG_LOG_ERROR_1( "Batch_Run: Can't open file (%s)!", Arg1);
}
else
{
fprintf( File_Output, "\n\n--------------------------------------------------------------------------------\n");
fprintf( File_Output, "Batch_Run: Starting execution (%s)...\n", Arg1);
// fprintf( File_Output, "\n\n--------------------------------------------------------------------------------\n");
// fprintf( File_Output, "Batch_Run: Starting execution (%s)...\n", Arg1);
LG_LOG_INFO_0( "--------------------------------------------------------------------------------");
LG_LOG_INFO_1( "Batch_Run: Starting execution (%s)...", Arg1);
Batch_Run( DS_Ptr_Ptr, File_Output, file_input, 0);
fprintf( File_Output, "\n");
fprintf( File_Output, "Batch_Run: Ending execution (%s)...\n", Arg1);
// fprintf( File_Output, "\n");
// fprintf( File_Output, "Batch_Run: Ending execution (%s)...\n", Arg1);
LG_LOG_INFO_1( "Batch_Run: Ending execution (%s)...", Arg1);
fclose( file_input);
}
@ -1581,11 +1633,21 @@ void Batch_Run( NDT_Root **DS_Ptr_Ptr, FILE *File_Output, FILE *File_Input,
int main( int argc, char **argv)
{
NDT_Root *ds_ptr = NULL;
int rc = 0;
LGT_Status lg_status;
NDT_Root *ds_ptr = NULL;
if( ( lg_status = LG_Library_Open( LGD_LOG_WRITER_DEFAULT, true)) != LGS_OK)
{
fprintf( stderr, "Can't open LibLog library: (%d)\n", lg_status);
return( -1);
}
LG_LOG_INFO_0( "Start NDBench");
/* Init Random numbers... */
t_start( t_exec);
t_stop( t_exec);
srand( seed_get(t_exec));
@ -1599,18 +1661,18 @@ int main( int argc, char **argv)
if( !strcmp( argv[1], "--help"))
{
fprintf( stderr, USAGE, argv[0]);
return( 1);
rc = 1;
}
#ifdef _LIBVER_SUPPORT
else if( !strcmp( argv[1], "--version"))
{
if( argc >= 3 && !strcmp( argv[2], "-v"))
{
return( VER_Object_Print( stdout, VERD_VERBOSE));
ec = VER_Object_Print( stdout, VERD_VERBOSE);
}
else
{
return( VER_Object_Print( stdout, VERD_MINIMAL));
rc = VER_Object_Print( stdout, VERD_MINIMAL);
}
}
#endif
@ -1619,21 +1681,30 @@ int main( int argc, char **argv)
/* Batch Mode */
Command_Exec( &ds_ptr, stdout, BATCH_RUN, argv[2], NULL, stdin);
return( 0);
rc = 0;
}
else
{
fprintf( stderr, USAGE, argv[0]);
return( -1);
rc = -1;
}
}
else
{
/* Interactive Mode */
Batch_Run( &ds_ptr, stdout, stdin, 1);
rc = 0;
}
LG_LOG_INFO_0( "End NDBench");
/* Interactive Mode */
if( ( lg_status = LG_Library_Close( true)) != LGS_OK)
{
fprintf( stderr, "Can't close LibLog library: (%d)\n", lg_status);
rc = -1;
}
Batch_Run( &ds_ptr, stdout, stdin, 1);
return( 0);
return( rc);
}

10
util/test-10M-s.ndb Normal file
View File

@ -0,0 +1,10 @@
Lib_Open 0
DS_Open 1
Index_List_Open 0-0
DS_Value_Add 1-10000000 0
DS_Value_Find 4999990-5000010
Index_List_To_Tree 0-0
DS_Value_Find 1-10000000
DS_Check
DS_Close
Lib_Close

10
util/test-10M.ndb Normal file
View File

@ -0,0 +1,10 @@
Lib_Open 0
DS_Open 0
Index_List_Open 0-0
DS_Value_Add 1-10000000 0
DS_Value_Find 4999990-5000010
Index_List_To_Tree 0-0
DS_Value_Find 1-10000000
DS_Check
DS_Close
Lib_Close

View File

@ -7,3 +7,5 @@ Batch_Run test-100K.ndb
Batch_Run test-100K-s.ndb
Batch_Run test-1M.ndb
Batch_Run test-1M-s.ndb
Batch_Run test-10M.ndb
Batch_Run test-10M-s.ndb