Screen Player
Upcoming SlideShare
Loading in...5
×
 

Screen Player

on

  • 2,781 views

Purpose of creating Screen Player, sp.py,

Purpose of creating Screen Player, sp.py,
Adapting to screen's logging system, Player in action, Charts builder, Screen Player Structure,
Code documentation

Statistics

Views

Total Views
2,781
Views on SlideShare
2,752
Embed Views
29

Actions

Likes
0
Downloads
0
Comments
0

4 Embeds 29

http://www.plug.org.ua 16
http://plug.org.ua 10
http://talk.quintagroup.com 2
http://ploneua.quintagroup.com 1

Accessibility

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Screen Player Screen Player Presentation Transcript

  • Screen Player Bogdan Klichuk © Quintagroup 2009
  • Table of Contents
    • Purpose
    • sp.py
    • Adapting to screen's logging system
    • Player in action
    • Charts builder
    • Structure
    • Code documentation
  • Purpose
    • Playback of the logs – simulating the original interaction of the user and terminal, recorder by 'screen'
    Purpose - load - tempo - speed Input echo Record Playback Screen player screen
    • Explore logs, navigate, have control on the playback's behavior, like using the media player
    Purpose
  • Demo
    • Investigate terminal activity and busyness, compare, generate charts for visual investigation
    Purpose
  • sp.py
  • sp.py sp.py is a Python utility, enabling you to access all the Screen Player's functionality rapidly Works with Python >= 2.5
  • sp.py sp.py by itself does not provide and does not implement any functionality, instead it provides a set of tasks, each of which can handle different work arguments sp.py
  • sp.py Screen Player provides multi-level config system. Any command line option for a specified task can be stored in config section, named after the task. Options at the level with higher priority override the same options at The level with lower priority. For example to set option -s STEP, --step=STEP for 'sp.py play': [play] step = 10 Levels priority order (ascending) Config system in Screen Player Execute task sp.py -с (--config) for any task
  • Adapting to screen's logging system
  • Adapting to screen's logging system How does Screen Player play back the logs saving the nature of the interaction and time characteristics? Time stamps allow you to restore the real speed, tempo and load of the 'screen' terminal, when the logs where being written. Two ways of how Screen Player plays back:
    • Uses time stamps, built into log file by 'screen'
    • Writes it's own time stamps, tracking the changes to the size of the log file (needs the utility to be launched while logging)
    • Screen Player can be adapted to the
    • format of the screen's time stamp.
    • Here's the example of default
    • screen's time stamp: [2]
  • Adapting to screen's logging system Time line 0 Stamp, 200 bytes Stamp, 800 bytes Stamp, 2000 bytes Stamp, 2100 bytes Structure of time stamps: Time stamp here is an exact moment of time and the size of the log file in this moment of time. Stamps data can be stored in different, yet 3 formats:
    • Python pickle format
    • CSV
    • Protocol buffer 2 [3]
    • (Language,platform independent)
  • Adapting to screen's logging system Track log file size and writing time stamps manually, sp.py track This command shows help for the task : To start tracking a file logfile.txt and producing stamps to logfile.txt.times , use this: To start tracking a file logfile.txt and producing stamps to custom stamps file, use this: Option --storage enables you to choose a type of the storage for the time-stamps: pickle, csv etc.
  • Adapting to screen's logging system Splitting the log file with built-in stamps to separate time stamps storage and clean log data, sp.py split Let us split the log file logfile_dirty.txt with built-in stamps, produce the clean log to logfile_clean.txt and store time stamps In logfile_clean.txt.times (adjusted implicitly): If you need just to clean up the log file from the built-in time stamps, use flag – c . In this case time stamps won't be stored. Type of the time stamps storage can be set by a flag --storage
  • Player in action Playback of the log file, having separate time-stamps and log files, sp.py play To start playing back a log file logfile.txt , when the time stamps storage is logfile.times, use this: -t option will let you set the time stamps storage explicitly. Start from the specified moment of time, defining a start point using a --jump(-j) option. A value has to be a screen player's ISO 8601 time stamp.
  • Playback of the log file with built-in time-stamps Player in action Assume, that you have a large log file, produced by screen with “ logtstamp” option on, and you want to play it back easily, not having to worry about the separate time-stamps storage and “clean” log file. Use -d (--dirty) option:
  • Player in action Screen player's ISO 8601 date/time format A basic format of the date/time in ISO 8601 is: Screen player offers optional ISO 8601 format, when any count of the parameter can be omitted and inherited from the default date/time. For example: In ' sp.py play' our stamp is based on a default stamp – first one from the time stamps storage, here we omitted the month, day, hour and Time zone – all this parameters will be inherited from the default stamp
  • Adapting to screen's logging system Investigating the time line, sp.py tinfo Let us retrieve the information about the time line, using time stamps storage logfile.times. The command shows the start & end points, count of stamps, full duration of the time line: To write all the time stamps to a file as CSV values, use flag -- all :
  • Player in action List of the shortcuts can be retrieved using this command: Controlling the playback. Player shortcuts To adjust the size of the step, made when jumping back/forward: --step <seconds> option
  • Charts builder
  • Charts builder Screen player allows you to investigate the load and busyness of the 'screen' terminal in visual mode – drawing the statistics chart. This facility enables you to compare busyness of terminal in different periods of time, assess rise and falls in terminal activity, make conclusions.
  • Charts builder Chart building functionality can be accessed by sp.py 'chart' task. Let us build a chart, showing the activity of the terminal, which was being logged. Let us save the image, produced to a file image.png, with size 800x100 Our image.png may look like this now:
  • Charts builder Google charts sp.py chart functionality is based on Google Charts service from Google Inc. [4]
  • Structure
  • Structure sp.py – Python executable module, uses “screenlog” Python package. A package encapsulates the Screen Player functionality. Consists of several modules. Inside of the Screen Player sp.py screenlog package Gathering tasks – modules with __task__ attribute player.py timeparser.py tracker.py splitter.py statchart.py util.py __init__.py
  • “ screenlog” package logging system Structure . . . Level filter . . . Handlers logger “screenlog.module_N” logger “screenlog.module_3” logger “screenlog.module_2” logger “screenlog.module_1” logger “screenlog” screenlog module_1 module_2 module_3 module_N
  • Code documentation
  • Code documentation Doctests Screen Player code is well documented, doctests are included in the code into the docstrings. Screen Player offers an uility to test all the modules of “screenlog” by once:
  • Code documentation Epydoc Screen Player supports 'epydoc' documentation, it enables you to generate documentation in PDF or HTML format For example to generate HTML documentation for “screenlog” package, install Epydoc [5] and type:
  • Questions
  • Links
    • http://svn.quintagroup.com/lab/projects/screenplayer/trunk –
    • Screen Player source code.
    • http://man-wiki.net/index.php/1:screen - Screen man page
    • http://code.google.com/p/protobuf/ - Protocol Buffers project page
    • http://code.google.com/apis/chart/ - Google Charts dev's guide
    • http://epydoc.sourceforge.net/ - Epydoc project page