Mid-terms evaluations are knocking on door and its been quite a wild ride coding. Web development is a different ball game altogether and I am beginning to understand why they call JavaScript the world's best worst language :D
After I have spruced the Beacon code and finally finished the DocBook DTD with the initial subset, I am going to start the next big task of getting Beacon integrated with Zikula and Publican for a seamless documentation experience.
It looks like Zikula has some text editors and a plug-in for them. I have to find the best way to get Beacon fit in that work flow. Fortunately Beacon already has a feature that allows one to embed it on any page. So it shouldn't be that difficult.
Am still looking for a best way to get Beacon integrated with Publican. It would be nice if the community can suggest a way to do it.
Tuesday, July 7, 2009
Thursday, July 2, 2009
DocBook Editor 2
Just completed a tiny DTD for DocBook corresponding to the small set of tags for which I had written the XSLs. I am so glad it works! (http://dev.gentooexperimental.org/~n9986/beacon/editor/ works best with firefox)
Now on it is just a matter of adding more elements to get a richer tag-set for DocBook till the mid-term evals. The basic infra is all set up (will try to keep improving usability though).
Also added a brand new and better CSS.
On the other side I think I should try and get more community involvement into developing the editor as the number of DocBook elements is *huge*.
I'll start by explaining what beacon is and how it works.
Beacon is a What you see is what you mean editor which relies heavily on XSL for XML to HTML conversions and vice-versa.
Most of the work involved in making a plugin is writing the two XSLs. One is required for converting the XML to HTML so that it can be displayed in the browser. And the other for converting the HTML back to XML. All these operations are done on the server side using PHP (or Python).
One may wonder, why rewrite XSLs if they already exists, like for Docbook for example. The reason is that Beacon needs some 'hooks' in the generated HTML so it can pick up the nodes using Javascript. This is required to do multitude of tasks like rendering inline editors, maintaining structural sanity, addition/deletion of new nodes, etc. Since HTML and Docbook XML tags are very different, there needs to be some way to map the XML tags over to HTML. These hooks are done using title attribute on tags. So for example, the tag will be rendered in HTML as:
< p title = "docbookPara"> Somethings are best with a title < /p >
Title tags tend to be most unobtrusive here and works well for DOM manipulation which is made even easier thanks to jQuery.
Once the HTML has been rendered, some Javascript magic makes it editable via inline editors of various types. We are still working on the node adding/deleting feature. Once that is done we will have a more or less a complete editor.
The validation of the generated HTML is kept in check via a Javascript based DTD.
So the user cycle of Beacon is:
new document -> XML -> HTML -> XML
All ajax-y communication is handled by JSON (except for file upload which uses an iframe of course).
Since its a web based it relies completely on Ajax for any post first page load. The UI is pretty much like a desktop Application with Tabs, sidebar etc.
To sum it up, a plugin now requires:
I will write a tutorial on how to make a plugin for docbook next. Will be nice if folks chip in to get in as many tags supported as possible.
Now on it is just a matter of adding more elements to get a richer tag-set for DocBook till the mid-term evals. The basic infra is all set up (will try to keep improving usability though).
Also added a brand new and better CSS.
On the other side I think I should try and get more community involvement into developing the editor as the number of DocBook elements is *huge*.
I'll start by explaining what beacon is and how it works.
Beacon is a What you see is what you mean editor which relies heavily on XSL for XML to HTML conversions and vice-versa.
Most of the work involved in making a plugin is writing the two XSLs. One is required for converting the XML to HTML so that it can be displayed in the browser. And the other for converting the HTML back to XML. All these operations are done on the server side using PHP (or Python).
One may wonder, why rewrite XSLs if they already exists, like for Docbook for example. The reason is that Beacon needs some 'hooks' in the generated HTML so it can pick up the nodes using Javascript. This is required to do multitude of tasks like rendering inline editors, maintaining structural sanity, addition/deletion of new nodes, etc. Since HTML and Docbook XML tags are very different, there needs to be some way to map the XML tags over to HTML. These hooks are done using title attribute on tags. So for example, the
Title tags tend to be most unobtrusive here and works well for DOM manipulation which is made even easier thanks to jQuery.
Once the HTML has been rendered, some Javascript magic makes it editable via inline editors of various types. We are still working on the node adding/deleting feature. Once that is done we will have a more or less a complete editor.
The validation of the generated HTML is kept in check via a Javascript based DTD.
So the user cycle of Beacon is:
new document -> XML -> HTML -> XML
All ajax-y communication is handled by JSON (except for file upload which uses an iframe of course).
Since its a web based it relies completely on Ajax for any post first page load. The UI is pretty much like a desktop Application with Tabs, sidebar etc.
To sum it up, a plugin now requires:
- Couple of XSLs
- Javascript based DTD
- Some trivial PHP code
- CSS + some template XMLs
I will write a tutorial on how to make a plugin for docbook next. Will be nice if folks chip in to get in as many tags supported as possible.
DocBook Editor 1
It's been very quiet in here. This month has been a marathon of coding and a lot of other events on the home front.
First off, a few non-GSoC related developments:
I started off by learning XSLT (tough!) and making an initial RPM for Beacon and submitted it for review. I created a Feature page and worked on deciding on an initial subset with the help of the Fedora-docs list.
Here are a few links to complement the above:
https://fedoraproject.org/wiki/DocBook_Editor_Documentation
https://fedoraproject.org/wiki/Features/DocBookEditor
https://fedoraproject.org/wiki/DocBook_Editor
Then, I constructed an initial XSL by referring to the example DocBook file in the Fedora Documentation repository and based on the initial tag set that was selected after a community review.
Initially, I fixed a few bugs in Beacon to learn the source code and worked on making it more convenient to add plug-ins by changing the implementation so that beacon needs only a DTD from the plug-in makers (which is us) rather than having us code the whole Javascript. A successful implementation of this would save a lot of time in feature addition and creation of plugins.
Apart from the DTD, I was learning the tools more from implementation perspective like JavaScript and jQuery library used in Beacon.
The last week has been the most exciting. Working with Nandeep Mali, the lead Beacon dev and my point of contact for the Beacon upstream, we got the DTD feature implemented to some extent and its working like a charm. The WYSIWYM is also working and just few more additions need to be done to make this a solid XML editor.
The DTD is actually a giant Javascript object which contains details about every node and its structure (like child, parent, siblings). One may think that why not use an existing WYSIWYG editor like TinyMCE. This is not very feasible because WYSIWYG editors are notorious for
the output they produce. This is what Beacon is trying to avoid by adding a different type of editor. The user will be places with a fill-in-the-blanks type of editor so the generated XML will retain its sanity and conform to Docbook DTD. Makes it easy for the Docs team as well.
Now for the treat: http://dev.gentooexperimental.org/~n9986/beacon/editor/
The above URL is a demo of what we have been working with (I hope the Gentoo URL is not a problem. Beacon was a Gentoo SoC project and I cannot get PHP with JSON and XSLs on my fedora account).
The work till now mainly consisted of writing the XSLs for DocBook and making changes to the beacon core. One final enhancement in the usability of beacon would be a drag and drop feature that has not been committed so far as it is very slow at the moment. Once that is ready it will be very easy to add nodes at any point and still not mess up the corresponding XML.
I have been writing the DTD for DocBook since yesterday and will be able to commit it by very soon. So we can expect another blog post about it very soon.
Has been a fun journey so far. More to come in the next post.
First off, a few non-GSoC related developments:
- I finished college. (Phew!)
- I got placed in Red Hat as an Associate Software Engineer. (gleee!)
- I won the Sun India Code For Freedom contest for my B. Tech Project. (ZOMG!! yes that was COMPLETELY unexpected!)
- I went out for a small trip this weekend after almost 2 years.
I started off by learning XSLT (tough!) and making an initial RPM for Beacon and submitted it for review. I created a Feature page and worked on deciding on an initial subset with the help of the Fedora-docs list.
Here are a few links to complement the above:
https://fedoraproject.org/
https://fedoraproject.org/
https://fedoraproject.org/
Then, I constructed an initial XSL by referring to the example DocBook file in the Fedora Documentation repository and based on the initial tag set that was selected after a community review.
Initially, I fixed a few bugs in Beacon to learn the source code and worked on making it more convenient to add plug-ins by changing the implementation so that beacon needs only a DTD from the plug-in makers (which is us) rather than having us code the whole Javascript. A successful implementation of this would save a lot of time in feature addition and creation of plugins.
Apart from the DTD, I was learning the tools more from implementation perspective like JavaScript and jQuery library used in Beacon.
The last week has been the most exciting. Working with Nandeep Mali, the lead Beacon dev and my point of contact for the Beacon upstream, we got the DTD feature implemented to some extent and its working like a charm. The WYSIWYM is also working and just few more additions need to be done to make this a solid XML editor.
The DTD is actually a giant Javascript object which contains details about every node and its structure (like child, parent, siblings). One may think that why not use an existing WYSIWYG editor like TinyMCE. This is not very feasible because WYSIWYG editors are notorious for
the output they produce. This is what Beacon is trying to avoid by adding a different type of editor. The user will be places with a fill-in-the-blanks type of editor so the generated XML will retain its sanity and conform to Docbook DTD. Makes it easy for the Docs team as well.
Now for the treat: http://dev.gentooexperimental.
The above URL is a demo of what we have been working with (I hope the Gentoo URL is not a problem. Beacon was a Gentoo SoC project and I cannot get PHP with JSON and XSLs on my fedora account).
The work till now mainly consisted of writing the XSLs for DocBook and making changes to the beacon core. One final enhancement in the usability of beacon would be a drag and drop feature that has not been committed so far as it is very slow at the moment. Once that is ready it will be very easy to add nodes at any point and still not mess up the corresponding XML.
I have been writing the DTD for DocBook since yesterday and will be able to commit it by very soon. So we can expect another blog post about it very soon.
Has been a fun journey so far. More to come in the next post.
Saturday, May 2, 2009
GSoCer again!
It feels awesome as I type this :) I am a GSoC student for Fedora this year too! I'll be working on Implementing a DocBook plug-in for Beacon. I am being mentored by Yaakov Nemoy and Karsten Wade is my technical guide! I feel honored to work with such amazing people :)
Hope the documentation team finds the editor useful.
Hope the documentation team finds the editor useful.
Monday, February 23, 2009
What's been up...
Phew! back to blogger after a long time, I must say after trying so hard to get over my hesitation, I am not quite successful in getting myself into blogging.
What has been up recently is that I finally got started with my Red Hat internship. My target is to introduce java profiling in SystemTap. I have been reading the SystemTap code to find out where exactly the tokens are parsed and where is the code translated into the corresponding C code.
To an extent I have been successful thanks to the comments in the main.cxx stating which phase begins when, but I guess the use of kprobes has somewhat hidden how the token representing the probe point is mapped to the location where it is actually found (or maybe it is not and I could not find it).
Also I have found a few C based java application profilers like JMP (TIJMP for the JVMTI supporting versions of java). I am looking at their code to know how to interface with the JVM using such tools.
Looking forward to be able to accomplish the task.
On the Sarai Fellowship front I am still in the process of recording the speech samples for my speech recognition project for the OLPC. Recording speech samples and typing out the text has turned out to be a lot more time consuming and laborious than I initially anticipated (Might also be because I need to arrange my schedule according to the times when the children are available which is becoming difficult because of my classes). I am also very hopeful of getting an XO soon thanks to Sankarshan Sir, Mr. Amit and Mr. Sayamindu.
I am praying it all comes out fine.
Next, I was invited to the National Institute of Technology, Durgapur to talk to the newerbies about how to contribute to FOSS in their annual FOSS festival Mukti.in.
It was an amazing experience. I talked about the philosophy of FOSS, why should they contribute and whats in it for them. Then I moved on to what it takes to be a contributor and how to contribute. The How part was divided into two categories, for those who want to contribute code, and for those who want to contribute by other means like helping out with the artwork, documentation, translations, publicity etc. I also talked about Fedora and OLPC in slight details as I could supplement the information there by my own experience. The presentation slides can be found here.
It was nice to try and answer questions from the audience when they gave me their skill set and asked me where could they fit in. It was also heartening to see people interested in my GSoC project and asking me about system side programming and SystemTap.
Over all, I was satisfied at the end of the talk and felt it was a job well done though I was tensed about screwing up the schedule of the event by extending the talk by about an hour.
What has been up recently is that I finally got started with my Red Hat internship. My target is to introduce java profiling in SystemTap. I have been reading the SystemTap code to find out where exactly the tokens are parsed and where is the code translated into the corresponding C code.
To an extent I have been successful thanks to the comments in the main.cxx stating which phase begins when, but I guess the use of kprobes has somewhat hidden how the token representing the probe point is mapped to the location where it is actually found (or maybe it is not and I could not find it).
Also I have found a few C based java application profilers like JMP (TIJMP for the JVMTI supporting versions of java). I am looking at their code to know how to interface with the JVM using such tools.
Looking forward to be able to accomplish the task.
On the Sarai Fellowship front I am still in the process of recording the speech samples for my speech recognition project for the OLPC. Recording speech samples and typing out the text has turned out to be a lot more time consuming and laborious than I initially anticipated (Might also be because I need to arrange my schedule according to the times when the children are available which is becoming difficult because of my classes). I am also very hopeful of getting an XO soon thanks to Sankarshan Sir, Mr. Amit and Mr. Sayamindu.
I am praying it all comes out fine.
Next, I was invited to the National Institute of Technology, Durgapur to talk to the newerbies about how to contribute to FOSS in their annual FOSS festival Mukti.in.
It was an amazing experience. I talked about the philosophy of FOSS, why should they contribute and whats in it for them. Then I moved on to what it takes to be a contributor and how to contribute. The How part was divided into two categories, for those who want to contribute code, and for those who want to contribute by other means like helping out with the artwork, documentation, translations, publicity etc. I also talked about Fedora and OLPC in slight details as I could supplement the information there by my own experience. The presentation slides can be found here.
It was nice to try and answer questions from the audience when they gave me their skill set and asked me where could they fit in. It was also heartening to see people interested in my GSoC project and asking me about system side programming and SystemTap.
Over all, I was satisfied at the end of the talk and felt it was a job well done though I was tensed about screwing up the schedule of the event by extending the talk by about an hour.
Saturday, October 11, 2008
Boot (limn/chart)?
Had drafted a small write-up on bootlimn sometime ago. About what is bootlimn, how does it work, how is it different from bootchart and how to interpret the output of bootlimn.
Just pasting the write-up here for anyone who is interested..
Just pasting the write-up here for anyone who is interested..
Bootlimn
===========================================
One line description:
It is an analysis and visualization tool for the linux boot process.
===========================================
Working:
Bootlimn uses systemtap[0], a kernel-probing language to extract the
data in an event-based structure where the systemtap scripts probe for
certain functions to be called or a small time-period to elapse before
triggering a corresponding probe handler.
The probe handler contains details as to how to log the information.
This information is stored in XML format for standardization and for
facilitating its use by interested third parties. This information is
parsed using a SAX interface and is used for rendering an SVG image,
whose format is heavily inspired by the svg output of Bootchart[1].
===========================================
Interpretation of results (most important for any user):
An example file is sent along with this text. The XML folder contains
the output as given by the systemtap scripts.
The final bootlimn output consists of an SVG image and five text files.
a) SVG image ( This image has a template similar to Bootchart):
Header: The time shows how long (in seconds) the boot process took.
CPU stats: The first rectangle shows the CPU stats. The pink plot (in
the background) showing the CPU utilization and the blue plot (in the
foreground) showing the CPU throughput.
Disk stats: The second rectangle shows the CPU stats. The pink plot
(in the background) showing the Disk utilization and the green plot
(in the foreground) showing the disk throughput.
The syscalls that have been probed are listed along with their color
coding.
Process Tree: The process tree differs from the classical process tree
in Bootchart in the following ways:
i) The processes are listed in the chronological order of their initial
call and not necessarily as parent child blocks as in bootchart. As the
boot is sequential, a child is never rendered before a parent but the
child and the parent may be separated by a few intermittent processes.
The parent-child relationship is shown by dotted lines connecting the
parent and the child.
ii) All the actions are rendered. But to bring the image to a practical
size, process blocks instead of processes have been used. The processes
with the same name have been merged into a process block (the individual
rectangles in the tree), and all the calls made to the processes in the
process block are rendered sequentially. Hence, one might observe
sys_exit being called more than once on the same process block but the
block might have a sys_clone called before the first exit. The criteria
for trimming the tree can be easily altered to suit various purposes
but changing the condition in the uniqueprocess generator (in the
SVGRenderer.java).
iii) The color code represents the last sys_call that acted upon the
process and not the state directly. This was done because Bootlimn,
unlike Bootchart, does not poll the /proc directory and probes the system
calls instead.
iv) Flexible level of detail: By default, to render the entire image
with manageable dimensions and still be accurate, the timestamps collected
were in milli-seconds. And while rendering each pixel represents 0.1s.
As, no information is discarded while rendering, changing the level of
detail is very easy.
The level of detail in the case of bootlimn is defined by:
The timestamps unit (systemtap offers options to gather timestamps in ns,
ms etc. i.e. by changing the gettimeofday_ms in the systemtap scripts
in stp folder, we can change the level of detail).
The image size and the scale factor in the renderer.java
The scalability of SVG images can be used to keep the image size manageable.
There is no provision to concentrate on a part of boot process and give a
separate detailed view of that part as of now.
b) The text files.
The systemtap scripts are written so as to gather as much information as
possible.As displaying all the details on a graph is not possible, there are
five complementary files that give all the details collected by the systemtap
scripts.
i)The Ioblock.txt gives all the block IO details:
It prints the text output of the ioblock tapset.
It has:
type - whether it was a request for IO or a signal to end
time - timestamp
devname - block device name
ino - i-node number of the mapped file
error - its value is zero on success
sector - beginning sector for the entire bio
flags -
BIO_UPTODATE 0 ok after I/O completion
BIO_RW_BLOCK 1 RW_AHEAD set, and read/write would block
BIO_EOF 2 out-out-bounds error
BIO_SEG_VALID 3 nr_hw_seg valid
BIO_CLONED 4 doesn't own data
BIO_BOUNCED 5 bio is a bounce bio
BIO_USER_MAPPED 6 contains user pages
BIO_EOPNOTSUPP 7 not supported
rw - binary trace for read/write request
vcnt - bio vector count which represents number of array element (page,
offset, length) which make up this I/O request
idx - offset into the bio vector array
phys_segments - number of segments in this bio after physical address
coalescing is performed.
hw_segments - number of segments after physical and DMA remapping
hardware coalescing is performed
size - total size in bytes
bdev - target block device
bdev_contains - points to the device object which contains the
partition (when bio structure represents a partition)
p_start_sect - points to the start sector of the partition
structure of the device
ii) The Perpro.txt gives the per process CPU usage details
It has:
time - timestamp
pid - process id
execname - name of the process
probefunc - the probing function
utime - the user time of the process
stime - the system time of the process
iii) The Process.txt contains the Process details ( the process tree
is derived out of the same XML as this file.
It has:
time - timestamp
pid - process id
ppid - parent process id
execname - process name
probefunc - probing function
pexecname - parent process name
misc - null as of now. any additional information can be added
iv) The Readwrite.txt contains the details of individual system reads
and writes.
It has:
rcount - read count so far
wcount - write count so far
time - timestamp
pid - process id
execname - process name
pexecname - parent process name
type - read or write
file - the file to which data was written or data was read from
v) The Stats.txt contains the CPU and disk statistics. This file is a
direct mapping to the first two rectangles in the image showing CPU and
disk stats.
It has:
time - timestamp
CPUutil - CPU utilization
CPUtput - CPU throughput
diskutil - Disk utilization
disktput - Disk throughput
==============================================
Source:
The svn version of bootlimn can be checked out from [2] and a tarball can
be found at [3].
==============================================
References
[0] http://sourceware.org/systemtap/
[1] http://www.bootchart.org/
[2] http://code.google.com/p/bootlimn/source/checkout
[3] http://code.google.com/p/google-summer-of-code-2008-fedora/downloads/list
============================================================================
Bootlimn on F9
On a hurrah note, finally able to run bootlimn on F9. And am too glad that it required no modification of bootlimn code. I just had to get my systemtap settings right.
The output of the bootlimn from F8 and F9 can be downloaded from here.
The output of the bootlimn from F8 and F9 can be downloaded from here.
Subscribe to:
Posts (Atom)