Go to the documentation of this file.
56 #include "debug/Drain.hh"
65 blockSize(
p.blk_size),
66 pageSize(
p.page_size),
67 GCActivePercentage(
p.GC_active),
68 readLatency(
p.read_lat),
69 writeLatency(
p.write_lat),
70 eraseLatency(
p.erase_lat),
71 dataDistribution(
p.data_distribution),
72 numPlanes(
p.num_planes),
77 planeMask(numPlanes - 1),
78 planeEventQueue(numPlanes),
90 if (numPlanes & planeMask)
91 fatal(
"Number of planes is not a power of 2 in flash device.\n");
160 uint64_t logic_page_addr = address /
pageSize;
161 uint32_t plane_address = 0;
175 " logic address 0x%8x\n",
index,
202 time[plane_address] +=
remap(logic_page_addr);
231 plane_address = (time[plane_address] > time[
count]) ? plane_address
237 if (time[
count] != 0) {
281 uint8_t plane_address = 0;
283 uint8_t next_event = 0;
286 for (plane_address = 0; plane_address <
numPlanes; plane_address++) {
313 for (plane_address = 0; plane_address <
numPlanes; plane_address++) {
318 next_event = plane_address;
460 :
Stats::Group(parent,
"FlashDevice"),
462 "Number of Garbage collector activations"),
466 "Histogram of file system accesses"),
470 using namespace Stats;
532 int location_table_size;
551 DPRINTF(Drain,
"Flash device is draining...\n");
554 DPRINTF(Drain,
"Flash device in drained state\n");
570 DPRINTF(Drain,
"Flash device is still draining\n");
572 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
#define fatal(...)
This implements a cprintf based fatal() function.
@ 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.
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.
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
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
Stats::Histogram fileSystemAccess
FlashDevice(const FlashDeviceParams &)
Initialize functions.
void signalDrainDone() const
Signal that an object is drained.
FlashDeviceStats(Stats::Group *parent)
const std::string & name()
#define SERIALIZE_SCALAR(scalar)
void paramOut(CheckpointOut &cp, const std::string &name, ExtMachInst const &machInst)
DrainState drainState() const
Return the current drain state of an object.
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 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
Tick curTick()
The universal simulation clock.
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.
void paramIn(CheckpointIn &cp, const std::string &name, ExtMachInst &machInst)
bool getUnknownPages(uint32_t index)
Function to test if a page is known.
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.
Stats::Scalar totalGCActivations
Amount of GC activations.
Generated on Tue Mar 23 2021 19:41:25 for gem5 by doxygen 1.8.17