www.pudn.com > efs.rar > fs_benchmark.h


/***********************************************************************
 * fs_benchmark.h
 *
 * Copyright (C) 2005-2006 QUALCOMM, Inc.
 *
 * Description: This file declares the functions which can be used for
 *              testing the performance of EFS2
 *
 ***********************************************************************/

/*===========================================================================

                        EDIT HISTORY FOR MODULE

  This section contains comments describing changes made to the module.
  Notice that changes are listed in reverse chronological order.

  $Header: //depot/asic/MSMSHARED/services/efs/MSM_EFS.01.02/fs_benchmark.h#2 $ $DateTime: 2006/10/30 17:51:52 $ $Author: davidb $

when         who   what, where, why
----------   ---   ---------------------------------------------------------
2006-10-17    sh    Added hotplug sector counters
2005-08-12    kk    Added benchmark queue data declarations
2005-03-29    sh    Created (based on fs_testapp.h)

===========================================================================*/

#ifndef __FS_BENCHMARK_H__
#define __FS_BENCHMARK_H__

#include "comdef.h"
#include "queue.h"
#include "rex.h"
#include "fs_sys_types.h"

/*
 * These are the posible states of the command and report queues
 */
enum fs_benchmark_queue_status_t {
  FS_BENCHMARK_ERROR    = -1,   /* Something wrong */
  FS_BENCHMARK_IDLE     =  0,   /* No benchmark running */
  FS_BENCHMARK_RESULT   =  1,   /* Result is ready */
  FS_BENCHMARK_RUNNING  =  2,   /* Running, but no result yet */
};

/* This kind of function is a benchmark test procedure */
typedef int (*fs_benchmark_func)(int32 *, char *);

/* Each test has a command code and function to call.
 * All tests take the same arguments. */
struct fs_benchmark_test
{
  uint32 cmd;
  fs_benchmark_func func;
};

extern struct fs_benchmark_test fs_benchmark_tests[];

/* Read, Write, Erase Counters */
struct fs_benchmark_counters {
  uint32 flash_write_page_counter;
  uint32 flash_write_partial_counter;
  uint32 flash_read_page_counter;
  uint32 flash_erase_block_counter;
  uint32 flash_erase_suspend_counter;
  uint32 hotplug_read_sector_counter;
  uint32 hotplug_write_sector_counter;
};

/* There exists one global counter set that is updated by EFS2 & Drivers. */
extern struct fs_benchmark_counters fs_counter;

#define FS_BENCHMARK_ARGS 5

/*
 * Command packet that Benchmark receives from Diag to start a test
 */
typedef PACKED struct {
  uint16 sequence;              /* Incrementing number to match packets */
  uint16 repeat;                /* How many times to run this test */
  uint16 command;               /* Which test to run */
  int32 args[FS_BENCHMARK_ARGS]; /* We allow up to five arguments */
  char path[1];                 /* Pathname is variable-length */
} fs_benchmark_test_cmd;

/*
 * The results of a benchmark test
 */
typedef PACKED struct
{
  fs_benchmark_test_cmd cmd;    /* The command (sans path) */
  uint16 failures;              /* Failure count */
  uint32 milliseconds;          /* Time in milliseconds */
  uint32 flash_write_page_counter;
  uint32 flash_write_partial_counter;
  uint32 flash_read_page_counter;
  uint32 flash_erase_block_counter;
  uint32 flash_erase_suspend_counter;
  uint32 total_bytes_write;
  uint32 total_bytes_read;
} fs_benchmark_report;

/* See fs_benchmark.c for descriptions */
void fs_benchmark_init (void);
void fs_cpu_hog_init (void);
void fs_benchmark_flush (void);
int fs_benchmark_put_cmd (fs_benchmark_test_cmd *cmd);
enum fs_benchmark_queue_status_t fs_benchmark_get_rpt (
  fs_benchmark_report *report);

#endif /* not __FS_BENCHMARK_H__ */