Go to the documentation of this file.
56 #include "debug/Drain.hh"
68 blockSize(
p.blk_size),
69 pageSize(
p.page_size),
70 GCActivePercentage(
p.GC_active),
71 readLatency(
p.read_lat),
72 writeLatency(
p.write_lat),
73 eraseLatency(
p.erase_lat),
74 dataDistribution(
p.data_distribution),
75 numPlanes(
p.num_planes),
80 planeMask(numPlanes - 1),
81 planeEventQueue(numPlanes),
93 if (numPlanes & planeMask)
94 fatal(
"Number of planes is not a power of 2 in flash device.\n");
163 uint64_t logic_page_addr = address /
pageSize;
164 uint32_t plane_address = 0;
178 " logic address 0x%8x\n",
index,
205 time[plane_address] +=
remap(logic_page_addr);
234 plane_address = (time[plane_address] > time[
count]) ? plane_address
240 if (time[
count] != 0) {
284 uint8_t plane_address = 0;
286 uint8_t next_event = 0;
289 for (plane_address = 0; plane_address <
numPlanes; plane_address++) {
316 for (plane_address = 0; plane_address <
numPlanes; plane_address++) {
321 next_event = plane_address;
462 : statistics::
Group(parent,
"FlashDevice"),
463 ADD_STAT(totalGCActivations, statistics::units::
Count::get(),
464 "Number of Garbage collector activations"),
466 "Histogram of write addresses"),
468 "Histogram of read addresses"),
470 "Histogram of file system accesses"),
472 "Histogram of write latency"),
474 "Histogram of read latency")
476 using namespace statistics;
538 int location_table_size;
557 DPRINTF(Drain,
"Flash device is draining...\n");
560 DPRINTF(Drain,
"Flash device in drained state\n");
576 DPRINTF(Drain,
"Flash device is still draining\n");
578 DPRINTF(Drain,
"Flash device is done draining\n");
DrainState drain() override
Checkpoint functions.
Tick curTick()
The universal simulation clock.
#define fatal(...)
This implements a cprintf based fatal() function.
Tick when() const
Get the time that the event is scheduled.
statistics::Scalar totalGCActivations
Amount of GC activations.
statistics::Histogram readAccess
#define UNSERIALIZE_SCALAR(scalar)
DrainState drainState() const
Return the current drain state of an object.
statistics::Histogram writeLatency
Histogram of access latencies.
#define UNSERIALIZE_CONTAINER(member)
@ ActionCopy
A copy involves taking all the used pages from a block and store it in another.
std::vector< uint32_t > blockEmptyEntries
number of empty entries
void unserialize(CheckpointIn &cp) override
Unserialize; needed to restore from checkpoints.
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...
EventFunctionWrapper planeEvent
Completion event.
void schedule(Event &event, Tick when)
std::string csprintf(const char *format, const Args &...args)
Actions
Defines the possible actions to the flash.
const FlagsType none
Nothing extra to print.
void sample(const U &v, int n=1)
Add a value to the distribtion n times.
void clearUnknownPages(uint32_t index)
Function to indicate that a page is known.
void accessDevice(uint64_t address, uint32_t amount, const std::function< void()> &event, Actions action)
Flash action function.
const FlagsType pdf
Print the percent of the total that this entry represents.
DrainState
Object drain/handover states.
void initializeFlash(uint64_t disk_size, uint32_t sector_size)
Initialization function; called when all disk specifics are known.
const uint32_t GCActivePercentage
Garbage collection algorithm emulator.
struct FlashDeviceStats stats
RequestHandler stats.
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
uint64_t Tick
Tick count type.
void reschedule(Event &event, Tick when, bool always=false)
std::vector< uint32_t > blockValidEntries
number of valid entries per block
statistics::Histogram readLatency
Tick accessTimes(uint64_t address, Actions accesstype)
Access time calculator.
@ Drained
Buffers drained, ready for serialization/handover.
Histogram & init(size_type size)
Set the parameters of this histogram.
std::vector< struct PageMapEntry > locationTable
address to logic place has a block and a page field
const std::string & name()
#define SERIALIZE_SCALAR(scalar)
statistics::Histogram fileSystemAccess
void signalDrainDone() const
Signal that an object is drained.
void serialize(CheckpointOut &cp) const override
Serialize; needed to create checkpoints.
const enums::DataDistribution dataDistribution
Flash organization.
void paramOut(CheckpointOut &cp, const std::string &name, ExtMachInst const &machInst)
#define SERIALIZE_CONTAINER(member)
Flash Device model The Flash Device model is a timing model for a NAND flash device.
void paramIn(CheckpointIn &cp, const std::string &name, ExtMachInst &machInst)
const Tick readLatency
Access latencies.
statistics::Histogram writeAccess
Histogram of address accesses.
void checkDrain()
Checkdrain; needed to enable checkpoints.
std::ostream CheckpointOut
uint32_t pagesPerBlock
Disk dimensions in pages and blocks.
bool getUnknownPages(uint32_t index)
Function to test if a page is known.
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
FlashDevice(const FlashDeviceParams &)
Initialize functions.
This is an interface between the disk interface (which will handle the disk data transactions) and th...
void actionComplete()
Event rescheduler.
std::vector< std::deque< struct CallBackEntry > > planeEventQueue
This vector of queues keeps track of all the callbacks per plane.
uint64_t diskSize
Disk sizes in bytes.
Tick remap(uint64_t logic_page_addr)
FTL functionality.
@ Draining
Draining buffers pending serialization/handover.
bool scheduled() const
Determine if the current event is scheduled.
FlashDeviceStats(statistics::Group *parent)
Generated on Sun Jul 30 2023 01:56:54 for gem5 by doxygen 1.8.17