CSC/ECE 517 Fall 2014/oss M1455 asa: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 14: Line 14:


== Steps of Implementation ==
== Steps of Implementation ==
We implemented the following steps on our linux machine:<br>
We implemented the following steps on our linux machine:<br><br>
'''• Build Servo'''
<br>
'''• Build Servo'''<br><br>
1. We first need to clone the servo repository using the following command:<br>
1. We first need to clone the servo repository using the following command:<br>
git clone https://www.github.com/servo/servo<br>
git clone https://www.github.com/servo/servo<br>
Line 35: Line 36:
[[File:test_op.png]]<br>
[[File:test_op.png]]<br>
<br>
<br>
'''• Add timing code'''<br>
'''• Add timing code'''<br><br>
1. In image_cache_task.rs , we have a fn decode which calls the load_from_memory fn in base.rs. <br>
1. In image_cache_task.rs , we have a fn decode which calls the load_from_memory fn in base.rs. <br>
2. Image decoding is implemented in this load_from_memory function.<br>
2. Image decoding is implemented in this load_from_memory function.<br>

Revision as of 23:51, 26 October 2014

EVALUATE REPLACING C IMAGE & FONT LIBRARIES WITH RUST EQUIVALENTS In this wiki we represent the steps involved in our OSS Mozilla Project using Rust Programming Language.

Introduction

Servo is an experimental web browser layout engine being developed by Mozilla Research for new generation hardware. The project has a symbiotic relationship with the Rust programming language, in which it is being developed. Rust is a new programming language for developing reliable and efficient systems.

Servo currently depends on a lot of C libraries, because Rust equivalents did not exist when the project started. We want to evaluate switching some of these to new Rust libraries that have been created. This project involves rewriting the code that uses these libraries as well as taking measurements before and after to determine the costs involved.

Aim

The aim of our project is display the time required by the decode function to decode images of different formats, e.g, jpeg, bmp, png, gif.

Steps of Implementation

We implemented the following steps on our linux machine:


• Build Servo

1. We first need to clone the servo repository using the following command:
git clone https://www.github.com/servo/servo

Now we have a local copy of the servo codebase.

2. We build the servo using

  ./mach build



3. Once our servo is built, we can run it using a test url

  ./mach run url 




• Add timing code

1. In image_cache_task.rs , we have a fn decode which calls the load_from_memory fn in base.rs.
2. Image decoding is implemented in this load_from_memory function.
3. So we added the timing code arround this function call in imacge_cache_task.rs 4. precise_time_ns() gives us the current time. 5. So we added it before the call to get the start time of decoding and after the call to get the end time. 6. Difference of the two gave us the decoding time, which can be printed on command line.

                   let start_time=precise_time_ns();
                   let image = load_from_memory(data.as_slice());

let end_time=precise_time_ns(); let required_time=(end_time-start_time) as f64/1000000f64;