db-export.txt 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. Database Export
  2. ===============
  3. perf tool's python scripting engine:
  4. tools/perf/util/scripting-engines/trace-event-python.c
  5. supports scripts:
  6. tools/perf/scripts/python/export-to-sqlite.py
  7. tools/perf/scripts/python/export-to-postgresql.py
  8. which export data to a SQLite3 or PostgreSQL database.
  9. The export process provides records with unique sequential ids which allows the
  10. data to be imported directly to a database and provides the relationships
  11. between tables.
  12. Over time it is possible to continue to expand the export while maintaining
  13. backward and forward compatibility, by following some simple rules:
  14. 1. Because of the nature of SQL, existing tables and columns can continue to be
  15. used so long as the names and meanings (and to some extent data types) remain
  16. the same.
  17. 2. New tables and columns can be added, without affecting existing SQL queries,
  18. so long as the new names are unique.
  19. 3. Scripts that use a database (e.g. exported-sql-viewer.py) can maintain
  20. backward compatibility by testing for the presence of new tables and columns
  21. before using them. e.g. function IsSelectable() in exported-sql-viewer.py
  22. 4. The export scripts themselves maintain forward compatibility (i.e. an existing
  23. script will continue to work with new versions of perf) by accepting a variable
  24. number of arguments (e.g. def call_return_table(*x)) i.e. perf can pass more
  25. arguments which old scripts will ignore.
  26. 5. The scripting engine tests for the existence of script handler functions
  27. before calling them. The scripting engine can also test for the support of new
  28. or optional features by checking for the existence and value of script global
  29. variables.