lib/dhry_1.c

Source file repositories/reference/linux-study-clean/lib/dhry_1.c

File Facts

System
Linux kernel
Corpus path
lib/dhry_1.c
Extension
.c
Size
8077 bytes
Lines
291
Domain
Kernel Services
Bucket
lib
Inferred role
Kernel Services: implementation source
Status
source implementation candidate

Why This File Exists

Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.

Dependency Surface

Detected Declarations

Annotated Snippet

if (Ch_1_Glob == 'A') {
			/* then, executed */
			Int_Loc -= 1;
			*Int_Par_Ref = Int_Loc - Int_Glob;
			Enum_Loc = Ident_1;
		} /* if */
	} while (Enum_Loc != Ident_1); /* true */
} /* Proc_2 */


static void Proc_4(void)
/*******/
/* executed once */
{
	Boolean Bool_Loc;

	Bool_Loc = Ch_1_Glob == 'A';
	Bool_Glob = Bool_Loc | Bool_Glob;
	Ch_2_Glob = 'B';
} /* Proc_4 */


static void Proc_5(void)
/*******/
/* executed once */
{
	Ch_1_Glob = 'A';
	Bool_Glob = false;
} /* Proc_5 */


int dhry(int n)
/*****/

  /* main program, corresponds to procedures        */
  /* Main and Proc_0 in the Ada version             */
{
	One_Fifty Int_1_Loc;
	One_Fifty Int_2_Loc;
	One_Fifty Int_3_Loc;
	char Ch_Index;
	Enumeration Enum_Loc;
	Str_30 Str_1_Loc;
	Str_30 Str_2_Loc;
	int Run_Index;
	int Number_Of_Runs;
	ktime_t Begin_Time, End_Time;
	u32 User_Time;

	/* Initializations */

	Next_Ptr_Glob = (Rec_Pointer) kzalloc_obj(Rec_Type, GFP_ATOMIC);
	if (!Next_Ptr_Glob)
		return -ENOMEM;

	Ptr_Glob = (Rec_Pointer) kzalloc_obj(Rec_Type, GFP_ATOMIC);
	if (!Ptr_Glob) {
		kfree(Next_Ptr_Glob);
		return -ENOMEM;
	}

	Ptr_Glob->Ptr_Comp = Next_Ptr_Glob;
	Ptr_Glob->Discr = Ident_1;
	Ptr_Glob->variant.var_1.Enum_Comp = Ident_3;
	Ptr_Glob->variant.var_1.Int_Comp = 40;
	strcpy(Ptr_Glob->variant.var_1.Str_Comp,
	       "DHRYSTONE PROGRAM, SOME STRING");
	strcpy(Str_1_Loc, "DHRYSTONE PROGRAM, 1'ST STRING");

	Arr_2_Glob[8][7] = 10;
	/* Was missing in published program. Without this statement,    */
	/* Arr_2_Glob[8][7] would have an undefined value.             */
	/* Warning: With 16-Bit processors and Number_Of_Runs > 32000,  */
	/* overflow may occur for this array element.                   */

	pr_debug("Dhrystone Benchmark, Version 2.1 (Language: C)\n");

	Number_Of_Runs = n;

	pr_debug("Execution starts, %d runs through Dhrystone\n",
		 Number_Of_Runs);

	/***************/
	/* Start timer */
	/***************/

	Begin_Time = ktime_get();

	for (Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index) {
		Proc_5();

Annotation

Implementation Notes