OpenASIP  2.0
ExecutionTrace.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file ExecutionTrace.cc
26  *
27  * Definition of ExecutionTrace class.
28  *
29  * @author Pekka Jääskeläinen 2004, 2009 (pjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #include <string>
34 #include "boost/format.hpp"
35 
36 #include "Application.hh"
37 #include "ExecutionTrace.hh"
38 #include "Conversion.hh"
39 #include "InstructionExecution.hh"
40 #include "FileSystem.hh"
41 #include "SQLite.hh"
42 #include "SimValue.hh"
44 #include "DataObject.hh"
45 
46 /// database table creation queries (CQ)
47 
48 const std::string CQ_DATABASE_INFO =
49 "CREATE TABLE database_info ("
50 " version INTEGER PRIMARY KEY,"
51 " tpef_filename TEXT);";
52 
53 const std::string CQ_INSTRUCTION_EXECUTION =
54 "CREATE TABLE instruction_execution ("
55 " cycle INTEGER PRIMARY KEY,"
56 " address INTEGER NOT NULL);";
57 
58 const std::string CQ_PROCEDURE_ADDRESS_RANGE =
59 "CREATE TABLE procedure_address_range ("
60 " first_address INTEGER UNIQUE, "
61 " last_address INTEGER UNIQUE, "
62 " procedure_name TEXT NOT NULL);";
63 
64 const std::string CQ_BUS_ACTIVITY =
65 "CREATE TABLE bus_activity ("
66 " cycle INTEGER NOT NULL,"
67 " bus TEXT NOT NULL,"
68 " segment TEXT NOT NULL,"
69 " squash BOOLEAN DEFAULT false,"
70 " data_as_int INTEGER,"
71 " data_as_double REAL);";
72 
74 "CREATE TABLE concurrent_register_file_access ("
75 " register_file TEXT NOT NULL,"
76 " reads INTEGER NOT NULL,"
77 " writes INTEGER NOT NULL,"
78 " count INTEGER NOT NULL);";
79 
80 const std::string CQ_REGISTER_ACCESS =
81 "CREATE TABLE register_access ("
82 " register_file TEXT NOT NULL,"
83 " register_index INTEGER NOT NULL,"
84 " reads INTEGER NOT NULL,"
85 " writes INTEGER NOT NULL);";
86 
87 const std::string CQ_FU_OPERATION_TRIGGERS =
88 "CREATE TABLE fu_operation_triggers ("
89 " function_unit TEXT NOT NULL,"
90 " operation TEXT NOT NULL,"
91 " count INTEGER NOT NULL);";
92 
93 const std::string CQ_BUS_WRITE_COUNTS =
94 "CREATE TABLE bus_write_counts ("
95 " bus TEXT NOT NULL,"
96 " writes INTEGER NOT NULL);";
97 
98 const std::string CQ_SOCKET_WRITE_COUNTS =
99 "CREATE TABLE socket_write_counts ("
100 " socket TEXT NOT NULL,"
101 " writes INTEGER NOT NULL);";
102 
103 const std::string CQ_TOTALS =
104 "CREATE TABLE totals ("
105 " value_name TEXT NOT NULL,"
106 " integer_value INTEGER);";
107 
108 /// the version number of the database schema
109 const int DB_VERSION = 1;
110 
111 /**
112  * Creates a new execution trace database.
113  *
114  * If the database file cannot be found, creates a new database file and
115  * initializes it. Some of the bigger traces are written to separate ascii
116  * files to speed up trace generation.
117  *
118  * The filenames are formed as follows:
119  *
120  * fileName The main traceDB relational database file,
121  * always created
122  * (e.g. foobar.tpef.1.trace).
123  * fileName.calls The call trace, produced with
124  * 'procedure_transfer_tracking' setting of ttasim
125  * (e.g. foobar.tpef.1.trace.calls).
126  * fileName.profile The instruction execution counts, produced with
127  * 'profile_data_saving' setting of ttasim
128  * (e.g. foobar.tpef.1.trace.profile).
129  *
130  * @param fileName Full path to the traceDB file to be opened.
131  * @return A pointer to opened execution trace database instance. Instance
132  * is owned by the client and should be deleted after use.
133  * @exception IOException If there was a problem opening the database,
134  * for example, if the file cannot be found and a new
135  * file cannot be created.
136  */
138 ExecutionTrace::open(const std::string& fileName) {
139  ExecutionTrace* traceDB =
140  new ExecutionTrace(
141  fileName, FileSystem::fileExists(fileName) &&
142  !FileSystem::fileIsWritable(fileName));
143  try {
144  bool newDatabase = !FileSystem::fileExists(fileName);
145  traceDB->open();
146  if (newDatabase) {
147  traceDB->initialize();
148  } else {
149  // tests that the file is really a trace DB by querying the
150  // instruction_execution table
151  traceDB->instructionExecutions();
152  }
153  } catch (const RelationalDBException& e) {
154  delete traceDB;
155  throw IOException(__FILE__, __LINE__, __func__, e.errorMessage());
156  }
157 
158  return traceDB;
159 }
160 
161 /**
162  * Initializes the trace files.
163  *
164  * For the traceDB sqlite file, starts a new transaction. Transaction is
165  * committed in destructor. This consumes lots of memory but should
166  * reduce I/O to the minimum.
167  */
168 void
172 }
173 
174 /**
175  * Constructor.
176  *
177  * @param fileName Filename used for accessing the database.
178  * @param readOnly Is the database read-only?
179  */
180 ExecutionTrace::ExecutionTrace(const std::string& fileName, bool readOnly) :
181  fileName_(fileName), callTrace_(
182  (fileName + ".calls").c_str(),
183  (FileSystem::fileExists(fileName) || readOnly) ?
184  std::fstream::in :
185  std::fstream::out | std::fstream::trunc),
186  instructionProfile_(
187  (fileName + ".profile").c_str(),
188  (FileSystem::fileExists(fileName) || readOnly) ?
189  std::fstream::in :
190  std::fstream::out | std::fstream::trunc),
191  readOnly_(readOnly), db_(new SQLite()),
192  dbConnection_(NULL), instructionExecution_(NULL) {
193 }
194 
195 /**
196  * Destructor.
197  *
198  * Closes the database and frees the resources connected to it. Commits the
199  * transaction so updates are written to disk.
200  *
201  */
203 
204  try {
205  if (instructionExecution_ != NULL) {
206  delete instructionExecution_;
207  instructionExecution_ = NULL;
208  }
209 
210  if (dbConnection_ != NULL) {
212  try {
213  assert(db_ != NULL);
215  dbConnection_ = NULL;
216  } catch (const RelationalDBException& e) {
218  __FILE__, __LINE__, __func__, e.errorMessage());
219  }
220  }
221 
222  callTrace_.close();
223  instructionProfile_.close();
224 
225  if (db_ != NULL) {
226  delete db_;
227  db_ = NULL;
228  }
229 
230  } catch (const Exception& e) {
231  debugLog(
232  "Exception almost leaked from ~ExecutionTrace! Message: " +
233  e.errorMessage());
234  }
235 }
236 
237 /**
238  * Initializes a new trace database.
239  *
240  * @exception IOException If an I/O error occured.
241  */
242 void
244  assert(dbConnection_ != NULL);
245 
246  try {
257 
259  (boost::format(
260  "INSERT INTO database_info(version) VALUES (%d);") %
261  DB_VERSION).str());
262 
263  } catch (const RelationalDBException& e) {
264  debugLog(
265  std::string("") + "Error while initializing TraceDB. " +
266  e.errorMessage());
267  throw IOException(__FILE__, __LINE__, __func__, e.errorMessage());
268  }
269 }
270 
271 /**
272  * Adds a new instruction execution record to the database.
273  *
274  * @param cycle The clock cycle on which the instruction execution happened.
275  * @param address The address of the executed instruction.
276  * @exception IOException In case an error in adding the data happened.
277  */
278 void
280  ClockCycleCount cycle, InstructionAddress address) {
281  const std::string query =
282  (boost::format(
283  "INSERT INTO instruction_execution(cycle, address) VALUES("
284  "%.0f, %d);") % cycle % address).str();
285 
286  assert(dbConnection_ != NULL);
287 
288  try {
289  dbConnection_->updateQuery(query);
290  } catch (const RelationalDBException& e) {
291  throw IOException(__FILE__, __LINE__, __func__, e.errorMessage());
292  }
293 }
294 
295 /**
296  * Adds a new instruction execution count record to the database.
297  *
298  * @param address The address of the executed instruction.
299  * @param count The count of clock cycles during which execution of the
300  * instruction happened.
301  * @exception IOException In case an error in adding the data happened.
302  */
303 void
305  InstructionAddress address, ClockCycleCount count) {
306  instructionProfile_ << address << "\t" << count << std::endl;
307 #if 0
308  const std::string query =
309  "INSERT INTO instruction_execution_count(address, count) VALUES(" +
310  Conversion::toString(address) + ", " +
311  Conversion::toString(count) + ");";
312 
313  assert(dbConnection_ != NULL);
314 
315  try {
316  dbConnection_->updateQuery(query);
317  } catch (const RelationalDBException& e) {
318  throw IOException(__FILE__, __LINE__, __func__, e.errorMessage());
319  }
320 #endif
321 }
322 
323 /**
324  * Adds a procedure address range entry to the database.
325  *
326  * An entry in this table tells the range of instruction addresses belonging
327  * to a procedure.
328  *
329  * @param firstAddress The starting address of the procedure.
330  * @param lastAddress The ending address of the procedure.
331  * @param name The name of the procedure.
332  * @exception IOException In case an error in adding the data happened.
333  */
334 void
336  InstructionAddress firstAddress, InstructionAddress lastAddress,
337  const std::string& procedureName) {
338  const std::string query =
339  "INSERT INTO procedure_address_range(first_address, last_address, "
340  "procedure_name) VALUES(" +
341  Conversion::toString(firstAddress) + ", " +
342  Conversion::toString(lastAddress) + ", '" +
343  procedureName + "');";
344 
345  assert(dbConnection_ != NULL);
346 
347  try {
348  dbConnection_->updateQuery(query);
349  } catch (const RelationalDBException& e) {
350  throw IOException(__FILE__, __LINE__, __func__, e.errorMessage());
351  }
352 }
353 
354 /**
355  * Queries database for instruction execution entries.
356  *
357  * @return A handle object which can be used to traverse through the results.
358  * The handle points to the first instruction execution in the list of
359  * executions, sorted by the cycle.
360  * @exception IOException If an I/O error occurs.
361  */
364  if (instructionExecution_ != NULL) {
365  delete instructionExecution_;
366  instructionExecution_ = NULL;
367  }
368 
369  try {
372  "SELECT * FROM instruction_execution ORDER BY cycle"));
373  } catch (const Exception& e) {
374  throw IOException(__FILE__, __LINE__, __func__, e.errorMessage());
375  }
376 
377  return *instructionExecution_;
378 }
379 
380 /**
381  * Adds a new bus activity record to the database.
382  *
383  * @param cycle The clock cycle in which the bus activity happened.
384  * @param busId The name of the bus.
385  * @param segmentId The name of the segment in the bus.
386  * @param squash Whether the transfer was squashed or not.
387  * @param data The data transferred.
388  * @exception IOException In case an error in adding the data happened.
389  */
390 void
392  ClockCycleCount cycle, const BusID& busId, const SegmentID& segmentId,
393  bool squash, const SimValue& data) {
394  std::string query =
395  "INSERT INTO bus_activity(cycle, bus, segment, squash, "
396  "data_as_int, data_as_double) VALUES(" +
397  Conversion::toString(cycle) + ", '" + busId + "', '" + segmentId +
398  "', ";
399 
400  if (squash)
401  query += "'TRUE'";
402  else
403  query += "'FALSE'";
404 
405  std::string doubleString = Conversion::toString(data.doubleWordValue());
406  if (doubleString == "nan")
407  doubleString = "NULL";
408 
409  if (!squash && &data != &NullSimValue::instance())
410  query += ", " + Conversion::toString(data.uIntWordValue()) + ", " +
411  doubleString + ")";
412  else
413  query += ", 0, 0.0)";
414 
415 
416  assert(dbConnection_ != NULL);
417 
418  try {
419  dbConnection_->updateQuery(query);
420  } catch (const RelationalDBException& e) {
421  debugLog(std::string("query: ") + query);
422  throw IOException(__FILE__, __LINE__, __func__, e.errorMessage());
423  }
424 }
425 
426 /**
427  * Adds a concurrent register file access statistics to the database.
428  *
429  * Statistics tells how many times a type of read/write count combination
430  * access happened. That is, how many times the given register file was
431  * read and written the given times simultaneously.
432  *
433  * @param registerFile The name of the register file.
434  * @param reads Count of simultaneous reads.
435  * @param writes Count of simultaneous writes.
436  * @param count The count of this type of accesses.
437  * @exception IOException In case an error in adding the data happened.
438  */
439 void
441  RegisterFileID registerFile, RegisterAccessCount reads,
442  RegisterAccessCount writes, ClockCycleCount count) {
443  const std::string query =
444  std::string("") +
445  "INSERT INTO concurrent_register_file_access("
446  " register_file, reads, writes, count) "
447  "VALUES('" + registerFile + "', " +
448  Conversion::toString(reads) + ", " +
449  Conversion::toString(writes) + ", " +
450  Conversion::toString(count) + ")";
451 
452  assert(dbConnection_ != NULL);
453 
454  try {
455  dbConnection_->updateQuery(query);
456  } catch (const RelationalDBException& e) {
457  debugLog(query + " failed!");
458  throw IOException(__FILE__, __LINE__, __func__, e.errorMessage());
459  }
460 }
461 
462 /**
463  * Adds a register access statistics to the database.
464  *
465  * Statistics tells how many times a register was read and written during
466  * simulation.
467  *
468  * @param registerFile The name of the register file.
469  * @param registerIndex The index of the register.
470  * @param reads Count of reads.
471  * @param writes Count of writes.
472  * @exception IOException In case an error in adding the data happened.
473  */
474 void
476  RegisterFileID registerFile, RegisterID registerIndex,
477  ClockCycleCount reads, ClockCycleCount writes) {
478  const std::string query =
479  (boost::format(
480  "INSERT INTO register_access("
481  " register_file, register_index, reads, writes) "
482  "VALUES('%s', %d, %.0f, %.0f)")
483  % registerFile % registerIndex % reads % writes).str();
484 
485  assert(dbConnection_ != NULL);
486 
487  try {
488  dbConnection_->updateQuery(query);
489  } catch (const RelationalDBException& e) {
490  debugLog(query + " failed!");
491  throw IOException(__FILE__, __LINE__, __func__, e.errorMessage());
492  }
493 }
494 
495 /**
496  * Returns the list of different concurrent register file access combinations
497  * and counts how many times those were encountered while simulating the
498  * program.
499  *
500  * @param registerFile The register file for which the stats are needed.
501  * @return A list of accesses. Must be deleted by the client after use.
502  * @exception IOException If an I/O error occurs.
503  */
506  ConcurrentRFAccessCountList* accesses = NULL;
507  try {
508  assert(dbConnection_ != NULL);
509 
510  RelationalDBQueryResult* result =
512  std::string("") +
513  "SELECT * FROM concurrent_register_file_access " +
514  "WHERE register_file LIKE('" + registerFile + "')");
515  accesses = new ConcurrentRFAccessCountList();
516  while (result->hasNext()) {
517  result->next();
518  accesses->push_back(
519  boost::make_tuple(
520  (result->data("reads")).integerValue(),
521  (result->data("writes")).integerValue(),
522  (result->data("count")).integerValue()));
523  }
524  delete result;
525  result = NULL;
526  } catch (const Exception& e) {
527  delete accesses;
528  throw IOException(__FILE__, __LINE__, __func__, e.errorMessage());
529  }
530 
531  return accesses;
532 }
533 
534 /**
535  * Adds a function unit operation execution statistics to the database.
536  *
537  * Statistics tells how many times an operation was executed in an function
538  * unit.
539  *
540  * @param functionUnit The name of the function unit.
541  * @param operation The name of the operation.
542  * @param count The count of executions.
543  * @exception IOException In case an error in adding the data happened.
544  */
545 void
547  FunctionUnitID functionUnit, OperationID operation,
548  OperationTriggerCount count) {
549  const std::string query =
550  std::string("") +
551  "INSERT INTO fu_operation_triggers("
552  " function_unit, operation, count) "
553  "VALUES('" + functionUnit + "', '" + operation + "', " +
554  Conversion::toString(count) + ")";
555 
556  assert(dbConnection_ != NULL);
557 
558  try {
559  dbConnection_->updateQuery(query);
560  } catch (const RelationalDBException& e) {
561  debugLog(query + " failed!");
562  throw IOException(__FILE__, __LINE__, __func__, e.errorMessage());
563  }
564 }
565 
566 /**
567  * Adds a procedure transfer tracking data entry.
568  *
569  * @param cycle The clock cycle in which the transfer occured.
570  * @param address The instruction address to which the execution changed.
571  * @param callAddress The address of the call.
572  * @param type Type of the transfer.
573  */
574 void
576  ClockCycleCount cycle, InstructionAddress address,
577  InstructionAddress sourceAddress, ProcedureEntryType type) {
578  callTrace_
579  << cycle << "\t" << address << "\t" << sourceAddress << "\t"
580  << type << std::endl;
581 }
582 
583 /**
584  * Returns the list of operation access counts for wanted function unit.
585  *
586  * @param functionUnit The function unit for which the stats are needed.
587  * @return A list of access counts. Must be deleted by the client after use.
588  * @exception IOException If an I/O error occurs.
589  */
592  FunctionUnitID functionUnit) const {
593  FUOperationTriggerCountList* accesses = NULL;
594  try {
595  assert(dbConnection_ != NULL);
596 
597  RelationalDBQueryResult* result =
599  std::string("") +
600  "SELECT * FROM fu_operation_triggers WHERE function_unit "
601  "LIKE('" + functionUnit + "')");
602  accesses = new FUOperationTriggerCountList();
603  while (result->hasNext()) {
604  result->next();
605  accesses->push_back(
606  boost::make_tuple(
607  (result->data("operation")).stringValue(),
608  (result->data("count")).integerValue()));
609  }
610  delete result;
611  result = NULL;
612  } catch (const Exception& e) {
613  delete accesses;
614  throw IOException(__FILE__, __LINE__, __func__, e.errorMessage());
615  }
616 
617  return accesses;
618 }
619 
620 /**
621  * Adds a socket write count statistics to the database.
622  *
623  * This stats tells in how many clock cycles was a socket used (transported
624  * data through).
625  *
626  * @param socket The name of the socket.
627  * @param count The count of writes/uses.
628  * @exception IOException In case an error in adding the data happened.
629  */
630 void
632  const std::string query =
633  std::string("") +
634  "INSERT INTO socket_write_counts(socket, writes) "
635  "VALUES('" + socket + "', " + Conversion::toString(count) + ")";
636 
637  assert(dbConnection_ != NULL);
638 
639  try {
640  dbConnection_->updateQuery(query);
641  } catch (const RelationalDBException& e) {
642  debugLog(query + " failed!");
643  throw IOException(__FILE__, __LINE__, __func__, e.errorMessage());
644  }
645 }
646 
647 /**
648  * Returns the count of clock cycles in which a socket was written to.
649  *
650  * In case no data was found for the given socket in DB, returns 0.
651  *
652  * @param socket The name of the socket.
653  * @return The count of writes/accesses.
654  */
657 
658  RelationalDBQueryResult* result = NULL;
659  ClockCycleCount count = 0;
660  try {
661  result = dbConnection_->query(
662  (boost::format(
663  "SELECT writes FROM socket_write_counts "
664  "WHERE socket LIKE('%s')") % socket).str());
665 
666  if (result->hasNext()) {
667  result->next();
668  count = (result->data("writes")).integerValue();
669  }
670  } catch (const Exception&) {
671  }
672  delete result;
673  result = NULL;
674  return count;
675 }
676 
677 /**
678  * Adds a bus write count statistics to the database.
679  *
680  * This stats tells in how many clock cycles was a bus used (transported
681  * data through).
682  *
683  * @param socket The name of the bus.
684  * @param count The count of writes/uses.
685  * @exception IOException In case an error in adding the data happened.
686  */
687 void
689  const std::string query =
690  std::string("") +
691  "INSERT INTO bus_write_counts(bus, writes) "
692  "VALUES('" + bus + "', " + Conversion::toString(count) + ")";
693 
694  assert(dbConnection_ != NULL);
695 
696  try {
697  dbConnection_->updateQuery(query);
698  } catch (const RelationalDBException& e) {
699  debugLog(query + " failed!");
700  throw IOException(__FILE__, __LINE__, __func__, e.errorMessage());
701  }
702 }
703 
704 /**
705  * Returns the count of clock cycles in which a bus was written to.
706  *
707  * In case no data was found for the given bus in DB, returns 0.
708  *
709  * @param bus The name of the bus.
710  * @return The count of writes/accesses.
711  */
714 
715  RelationalDBQueryResult* result = NULL;
716  ClockCycleCount count = 0;
717  try {
718  result = dbConnection_->query(
719  (boost::format(
720  "SELECT writes FROM bus_write_counts "
721  "WHERE bus LIKE('%s')") % bus).str());
722 
723  if (result->hasNext()) {
724  result->next();
725  count = (result->data("writes")).integerValue();
726  }
727  } catch (const Exception&) {
728  }
729  delete result;
730  result = NULL;
731  return count;
732 }
733 
734 /**
735  * Sets the total count of simulated clock cycles.
736  *
737  * @param count The count of cycles.
738  * @exception IOException In case an error in adding the data happened.
739  */
740 void
742  const std::string query =
743  std::string("") +
744  "INSERT INTO totals(value_name, integer_value) "
745  "VALUES('cycle_count', " + Conversion::toString(count) + ")";
746 
747  assert(dbConnection_ != NULL);
748 
749  try {
750  dbConnection_->updateQuery(query);
751  } catch (const RelationalDBException& e) {
752  debugLog(query + " failed!");
753  throw IOException(__FILE__, __LINE__, __func__, e.errorMessage());
754  }
755 }
756 
757 /**
758  * Gets the total count of simulated clock cycles.
759  *
760  * @return The count of cycles.
761  * @exception IOException In case an error in getting the data happened.
762  */
765  RelationalDBQueryResult* result = NULL;
766  try {
767  result = dbConnection_->query(
768  "SELECT integer_value FROM totals "
769  "WHERE value_name LIKE('cycle_count')");
770  if (!result->hasNext()) {
771  delete result;
772  result = NULL;
773  throw IOException(
774  __FILE__, __LINE__, __func__,
775  "No 'cycle_count' entry in 'totals' table.");
776  }
777  result->next();
778  ClockCycleCount count = (result->data("integer_value")).integerValue();
779  delete result;
780  result = NULL;
781  return count;
782  } catch (const Exception& e) {
783  delete result;
784  result = NULL;
785  throw IOException(__FILE__, __LINE__, __func__, e.errorMessage());
786  }
787 }
ExecutionTrace::ProcedureEntryType
ProcedureEntryType
a type for storing procedure entry type (entry/exit)
Definition: ExecutionTrace.hh:96
ExecutionTrace::socketWriteCount
ClockCycleCount socketWriteCount(SocketID socket) const
Definition: ExecutionTrace.cc:656
CQ_DATABASE_INFO
const std::string CQ_DATABASE_INFO
database table creation queries (CQ)
Definition: ExecutionTrace.cc:48
InstructionAddress
UInt32 InstructionAddress
Definition: BaseType.hh:175
ExecutionTrace::OperationTriggerCount
ClockCycleCount OperationTriggerCount
a type for operation trigger counts
Definition: ExecutionTrace.hh:93
FileSystem.hh
ExecutionTrace::addBusWriteCount
void addBusWriteCount(BusID socket, ClockCycleCount count)
Definition: ExecutionTrace.cc:688
RelationalDBConnection::updateQuery
virtual int updateQuery(const std::string &queryString)=0
Definition: RelationalDBConnection.cc:54
SimValue::doubleWordValue
DoubleWord doubleWordValue() const
Definition: SimValue.cc:1052
RelationalDBQueryResult.hh
CQ_REGISTER_ACCESS
const std::string CQ_REGISTER_ACCESS
Definition: ExecutionTrace.cc:80
RelationalDBException
Definition: Exception.hh:692
InstructionExecution.hh
RelationalDB::connect
virtual RelationalDBConnection & connect(const std::string &database, const std::string &login="", const std::string &password="", bool readOnly=false)=0
ExecutionTrace::fileName_
const std::string & fileName_
Filename of the trace database (sqlite file).
Definition: ExecutionTrace.hh:197
RelationalDBQueryResult::data
virtual const DataObject & data(std::size_t column) const =0
Definition: RelationalDBQueryResult.cc:96
Application::writeToErrorLog
static void writeToErrorLog(const std::string fileName, const int lineNumber, const std::string functionName, const std::string message, const int neededVerbosity=0)
Definition: Application.cc:224
ExecutionTrace::open
void open()
Definition: ExecutionTrace.cc:169
ExecutionTrace::ExecutionTrace
ExecutionTrace(const std::string &fileName, bool readOnly)
Definition: ExecutionTrace.cc:180
NullSimValue::instance
static SimValue & instance()
Definition: SimValue.cc:1642
ExecutionTrace::FUOperationTriggerCountList
std::list< FUOperationTriggerCount > FUOperationTriggerCountList
type to be used for lists of function operation execution counts
Definition: ExecutionTrace.hh:116
RelationalDBConnection::commit
virtual void commit()=0
Definition: RelationalDBConnection.cc:110
CQ_CONCURRENT_REGISTER_FILE_ACCESS
const std::string CQ_CONCURRENT_REGISTER_FILE_ACCESS
Definition: ExecutionTrace.cc:73
ExecutionTrace::addRegisterAccessCount
void addRegisterAccessCount(RegisterFileID registerFile, RegisterID registerIndex, ClockCycleCount reads, ClockCycleCount writes)
Definition: ExecutionTrace.cc:475
SimValue::uIntWordValue
UIntWord uIntWordValue() const
Definition: SimValue.cc:972
Conversion::toString
static std::string toString(const T &source)
RelationalDBQueryResult::hasNext
virtual bool hasNext()=0
Definition: RelationalDBQueryResult.cc:126
ExecutionTrace::RegisterFileID
std::string RegisterFileID
a type for storing register file identifiers
Definition: ExecutionTrace.hh:78
ExecutionTrace::addFunctionUnitOperationTriggerCount
void addFunctionUnitOperationTriggerCount(FunctionUnitID functionUnit, OperationID operation, OperationTriggerCount count)
Definition: ExecutionTrace.cc:546
SimValue
Definition: SimValue.hh:96
ExecutionTrace::SocketID
std::string SocketID
a type for storing socket identifiers
Definition: ExecutionTrace.hh:66
assert
#define assert(condition)
Definition: Application.hh:86
DB_VERSION
const int DB_VERSION
the version number of the database schema
Definition: ExecutionTrace.cc:109
ExecutionTrace::instructionProfile_
std::fstream instructionProfile_
The instruction profile file.
Definition: ExecutionTrace.hh:201
ExecutionTrace::busWriteCount
ClockCycleCount busWriteCount(BusID bus) const
Definition: ExecutionTrace.cc:713
RelationalDB::close
virtual void close(const RelationalDBConnection &connection)=0
FileSystem::fileIsWritable
static bool fileIsWritable(const std::string fileName)
RelationalDBQueryResult::next
virtual bool next()=0
Definition: RelationalDBQueryResult.cc:138
CQ_INSTRUCTION_EXECUTION
const std::string CQ_INSTRUCTION_EXECUTION
Definition: ExecutionTrace.cc:53
CQ_TOTALS
const std::string CQ_TOTALS
Definition: ExecutionTrace.cc:103
InstructionExecution
Definition: InstructionExecution.hh:45
Conversion.hh
ExecutionTrace
Definition: ExecutionTrace.hh:56
CQ_BUS_WRITE_COUNTS
const std::string CQ_BUS_WRITE_COUNTS
Definition: ExecutionTrace.cc:93
Application.hh
CQ_BUS_ACTIVITY
const std::string CQ_BUS_ACTIVITY
Definition: ExecutionTrace.cc:64
RelationalDBQueryResult
Definition: RelationalDBQueryResult.hh:46
__func__
#define __func__
Definition: Application.hh:67
ExecutionTrace::~ExecutionTrace
virtual ~ExecutionTrace()
Definition: ExecutionTrace.cc:202
ExecutionTrace::BusID
std::string BusID
a type for storing bus identifiers
Definition: ExecutionTrace.hh:63
ExecutionTrace::db_
RelationalDB * db_
Handle to the sqlite trace database.
Definition: ExecutionTrace.hh:205
ExecutionTrace::OperationID
std::string OperationID
a type for storing operation identifiers
Definition: ExecutionTrace.hh:75
RelationalDBConnection::query
virtual RelationalDBQueryResult * query(const std::string &queryString, bool init=true)=0
Definition: RelationalDBConnection.cc:80
ExecutionTrace::instructionExecutions
InstructionExecution & instructionExecutions()
Definition: ExecutionTrace.cc:363
Exception
Definition: Exception.hh:54
CQ_SOCKET_WRITE_COUNTS
const std::string CQ_SOCKET_WRITE_COUNTS
Definition: ExecutionTrace.cc:98
ExecutionTrace::SegmentID
std::string SegmentID
a type for storing bus segment identifiers
Definition: ExecutionTrace.hh:69
ExecutionTrace::addInstructionExecution
void addInstructionExecution(ClockCycleCount cycle, InstructionAddress address)
Definition: ExecutionTrace.cc:279
DataObject.hh
ExecutionTrace::instructionExecution_
InstructionExecution * instructionExecution_
Handle object for the queries of instruction executions.
Definition: ExecutionTrace.hh:209
FileSystem
Definition: FileSystem.hh:86
RelationalDBConnection::beginTransaction
virtual void beginTransaction()=0
Definition: RelationalDBConnection.cc:92
ExecutionTrace::functionUnitOperationTriggerCounts
FUOperationTriggerCountList * functionUnitOperationTriggerCounts(FunctionUnitID functionUnit) const
Definition: ExecutionTrace.cc:591
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
ExecutionTrace::FunctionUnitID
std::string FunctionUnitID
a type for storing function unit identifiers
Definition: ExecutionTrace.hh:72
ExecutionTrace::registerFileAccessCounts
ConcurrentRFAccessCountList * registerFileAccessCounts(RegisterFileID registerFile) const
Definition: ExecutionTrace.cc:505
ExecutionTrace::addConcurrentRegisterFileAccessCount
void addConcurrentRegisterFileAccessCount(RegisterFileID registerFile, RegisterAccessCount reads, RegisterAccessCount writes, ClockCycleCount count)
Definition: ExecutionTrace.cc:440
ExecutionTrace::open
static ExecutionTrace * open(const std::string &fileName)
Definition: ExecutionTrace.cc:138
RelationalDBConnection::DDLQuery
virtual void DDLQuery(const std::string &queryString)=0
Definition: RelationalDBConnection.cc:69
ExecutionTrace::addProcedureAddressRange
void addProcedureAddressRange(InstructionAddress firstAddress, InstructionAddress lastAddress, const std::string &procedureName)
Definition: ExecutionTrace.cc:335
CQ_PROCEDURE_ADDRESS_RANGE
const std::string CQ_PROCEDURE_ADDRESS_RANGE
Definition: ExecutionTrace.cc:58
FileSystem::fileExists
static bool fileExists(const std::string fileName)
SimValue.hh
ExecutionTrace::initialize
void initialize()
Definition: ExecutionTrace.cc:243
ExecutionTrace::simulatedCycleCount
ClockCycleCount simulatedCycleCount() const
Definition: ExecutionTrace.cc:764
CQ_FU_OPERATION_TRIGGERS
const std::string CQ_FU_OPERATION_TRIGGERS
Definition: ExecutionTrace.cc:87
ExecutionTrace::addBusActivity
void addBusActivity(ClockCycleCount cycle, const BusID &busId, const SegmentID &segmentId, bool squash, const SimValue &data=NullSimValue::instance())
Definition: ExecutionTrace.cc:391
ExecutionTrace::addInstructionExecutionCount
void addInstructionExecutionCount(InstructionAddress address, ClockCycleCount count)
Definition: ExecutionTrace.cc:304
ExecutionTrace::callTrace_
std::fstream callTrace_
The call trace file.
Definition: ExecutionTrace.hh:199
ExecutionTrace::addProcedureTransfer
void addProcedureTransfer(ClockCycleCount cycle, InstructionAddress address, InstructionAddress sourceAddress, ProcedureEntryType type)
Definition: ExecutionTrace.cc:575
ClockCycleCount
CycleCount ClockCycleCount
Alias for ClockCycleCount.
Definition: SimulatorConstants.hh:57
ExecutionTrace::ConcurrentRFAccessCountList
std::list< ConcurrentRFAccessCount > ConcurrentRFAccessCountList
type to be used for a list of concurrent RF accesses
Definition: ExecutionTrace.hh:108
ExecutionTrace::RegisterID
int RegisterID
a type for storing register ids
Definition: ExecutionTrace.hh:81
IOException
Definition: Exception.hh:130
ExecutionTrace::dbConnection_
RelationalDBConnection * dbConnection_
Handle to the database connection;.
Definition: ExecutionTrace.hh:207
ExecutionTrace::RegisterAccessCount
std::size_t RegisterAccessCount
a type for register access counts
Definition: ExecutionTrace.hh:90
debugLog
#define debugLog(text)
Definition: Application.hh:95
SQLite.hh
SQLite
Definition: SQLite.hh:45
ExecutionTrace::setSimulatedCycleCount
void setSimulatedCycleCount(ClockCycleCount count)
Definition: ExecutionTrace.cc:741
ExecutionTrace::addSocketWriteCount
void addSocketWriteCount(SocketID socket, ClockCycleCount)
Definition: ExecutionTrace.cc:631
ExecutionTrace.hh