Go to the documentation of this file.
56 #include "debug/Drain.hh"
63 FlashDeviceParams::create()
76 blockSize(
p->blk_size),
77 pageSize(
p->page_size),
78 GCActivePercentage(
p->GC_active),
79 readLatency(
p->read_lat),
80 writeLatency(
p->write_lat),
81 eraseLatency(
p->erase_lat),
82 dataDistribution(
p->data_distribution),
83 numPlanes(
p->num_planes),
87 planeMask(numPlanes - 1),
88 planeEventQueue(numPlanes),
100 if (numPlanes & planeMask)
101 fatal(
"Number of planes is not a power of 2 in flash device.\n");
170 uint64_t logic_page_addr = address /
pageSize;
171 uint32_t plane_address = 0;
185 " logic address 0x%8x\n",
index,
212 time[plane_address] +=
remap(logic_page_addr);
241 plane_address = (time[plane_address] > time[
count]) ? plane_address
247 if (time[
count] != 0) {
291 uint8_t plane_address = 0;
293 uint8_t next_event = 0;
296 for (plane_address = 0; plane_address <
numPlanes; plane_address++) {
323 for (plane_address = 0; plane_address <
numPlanes; plane_address++) {
328 next_event = plane_address;
473 using namespace Stats;
475 std::string fd_name =
name() +
".FlashDevice";
480 .
name(fd_name +
".totalGCActivations")
481 .
desc(
"Number of Garbage collector activations")
487 .
name(fd_name +
".writeAccessHist")
488 .
desc(
"Histogram of write addresses")
492 .
name(fd_name +
".readAccessHist")
493 .
desc(
"Histogram of read addresses")
497 .
name(fd_name +
".fileSystemAccessHist")
498 .
desc(
"Histogram of file system accesses")
504 .
name(fd_name +
".writeLatencyHist")
505 .
desc(
"Histogram of write latency")
509 .
name(fd_name +
".readLatencyHist")
510 .
desc(
"Histogram of read latency")
550 int location_table_size;
569 DPRINTF(Drain,
"Flash device is draining...\n");
572 DPRINTF(Drain,
"Flash device in drained state\n");
588 DPRINTF(Drain,
"Flash device is still draining\n");
590 DPRINTF(Drain,
"Flash device is done draining\n");
Stats::Histogram readLatency
std::vector< struct PageMapEntry > locationTable
address to logic place has a block and a page field
void regStats() override
Stats register function.
#define fatal(...)
This implements a cprintf based fatal() function.
virtual void regStats()
Callback to set stat parameters.
@ ActionCopy
A copy involves taking all the used pages from a block and store it in another.
bool scheduled() const
Determine if the current event is scheduled.
std::vector< uint32_t > unknownPages
when the disk is first started we are unsure of the number of used pages, this variable will help det...
uint32_t pagesPerBlock
Disk dimensions in pages and blocks.
#define UNSERIALIZE_SCALAR(scalar)
std::vector< uint32_t > blockEmptyEntries
number of empty entries
const Enums::DataDistribution dataDistribution
Flash organization.
#define UNSERIALIZE_CONTAINER(member)
void reschedule(Event &event, Tick when, bool always=false)
void clearUnknownPages(uint32_t index)
Function to indicate that a page is known.
This is an interface between the disk interface (which will handle the disk data transactions) and th...
void unserialize(CheckpointIn &cp) override
Unserialize; needed to restore from checkpoints.
void actionComplete()
Event rescheduler.
uint64_t Tick
Tick count type.
void accessDevice(uint64_t address, uint32_t amount, const std::function< void()> &event, Actions action)
Flash action function.
DrainState drain() override
Checkpoint functions.
Tick when() const
Get the time that the event is scheduled.
void paramOut(CheckpointOut &cp, const string &name, ExtMachInst const &machInst)
const FlagsType none
Nothing extra to print.
const Tick readLatency
Access latencies.
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
@ Drained
Buffers drained, ready for serialization/handover.
DrainState
Object drain/handover states.
FlashDevice(const FlashDeviceParams *)
Initialize functions.
struct FlashDeviceStats stats
RequestHandler stats.
Stats::Histogram writeAccess
Histogram of address accesses.
Tick accessTimes(uint64_t address, Actions accesstype)
Access time calculator.
void schedule(Event &event, Tick when)
void checkDrain()
Checkdrain; needed to enable checkpoints.
std::vector< uint32_t > blockValidEntries
number of valid entries per block
Stats::Histogram fileSystemAccess
void signalDrainDone() const
Signal that an object is drained.
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
const std::string & name()
#define SERIALIZE_SCALAR(scalar)
DrainState drainState() const
Return the current drain state of an object.
virtual const std::string name() const
const uint32_t GCActivePercentage
Garbage collection algorithm emulator.
Tick remap(uint64_t logic_page_addr)
FTL functionality.
EventFunctionWrapper planeEvent
Completion event.
Stats::Histogram writeLatency
Histogram of access latencies.
Stats::Histogram readAccess
const FlagsType pdf
Print the percent of the total that this entry represents.
#define SERIALIZE_CONTAINER(member)
Actions
Defines the possible actions to the flash.
Flash Device model The Flash Device model is a timing model for a NAND flash device.
void paramIn(CheckpointIn &cp, const string &name, ExtMachInst &machInst)
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
std::vector< std::deque< struct CallBackEntry > > planeEventQueue
This vector of queues keeps track of all the callbacks per plane.
std::ostream CheckpointOut
void initializeFlash(uint64_t disk_size, uint32_t sector_size)
Initialization function; called when all disk specifics are known.
Histogram & init(size_type size)
Set the parameters of this histogram.
bool getUnknownPages(uint32_t index)
Function to test if a page is known.
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
uint64_t diskSize
Disk sizes in bytes.
std::string csprintf(const char *format, const Args &...args)
void serialize(CheckpointOut &cp) const override
Serialize; needed to create checkpoints.
@ Draining
Draining buffers pending serialization/handover.
Tick curTick()
The current simulated tick.
Stats::Scalar totalGCActivations
Amount of GC activations.
Generated on Wed Sep 30 2020 14:02:10 for gem5 by doxygen 1.8.17