blob: 687a8293904b47654424334118378dac5b509df8 [file] [log] [blame]
Yuheng Longf20cffa2013-06-03 18:46:00 -07001"""A reproducing entity.
2
Yuheng Long49358b72013-07-10 14:45:29 -07003Part of the Chrome build flags optimization.
4
Yuheng Longf20cffa2013-06-03 18:46:00 -07005The Task class is used by different modules. Each module fills in the
6corresponding information into a Task instance. Class Task contains the bit set
7representing the flags selection. The builder module is responsible for filling
8the image and the checksum field of a Task. The executor module will put the
9execution output to the execution field.
10"""
11
12__author__ = 'yuhenglong@google.com (Yuheng Long)'
13
14
15class Task(object):
16 """A single reproducing entity.
17
18 A single test of performance with a particular set of flags. It records the
19 flag set, the image, the check sum of the image and the cost.
20 """
21
22 def __init__(self, flag_set):
23 """Set up the optimization flag selection for this task.
24
25 Args:
26 flag_set: the optimization flag set that is encapsulated by this task.
27 """
28 self._flag_set = flag_set
29
Yuheng Long26ec76c2013-07-11 07:49:01 -070030 def ReproduceWith(self, other):
Yuheng Longf20cffa2013-06-03 18:46:00 -070031 """Create a new SolutionCandidate by reproduction with another.
32
33 Mix two Tasks together to form a new Task of the same class. This is one of
34 the core functions of a GA.
35
36 Args:
37 other: The other Task to reproduce with.
38
39 Returns: A Task that is a mix between self and other.
40 """
41 pass
42
Yuheng Long26ec76c2013-07-11 07:49:01 -070043 def Compile(self):
Yuheng Longf20cffa2013-06-03 18:46:00 -070044 """Run a compile.
45
46 This method compile an image using the present flags, get the image,
47 test the existent of the image and gathers monitoring information, and sets
48 the internal cost (fitness) for this set of flags.
49 """
50 pass
51
Yuheng Long26ec76c2013-07-11 07:49:01 -070052 def GetFlags(self):
Yuheng Longf20cffa2013-06-03 18:46:00 -070053 pass
54
Yuheng Long26ec76c2013-07-11 07:49:01 -070055 def SetFlags(self, flags):
Yuheng Longf20cffa2013-06-03 18:46:00 -070056 pass
57
Yuheng Long26ec76c2013-07-11 07:49:01 -070058 def GetChecksum(self):
Yuheng Longf20cffa2013-06-03 18:46:00 -070059 pass
60
Yuheng Long26ec76c2013-07-11 07:49:01 -070061 def SetChecksum(self, checksum):
Yuheng Longf20cffa2013-06-03 18:46:00 -070062 pass
63
Yuheng Long26ec76c2013-07-11 07:49:01 -070064 def GetImage(self):
Yuheng Longf20cffa2013-06-03 18:46:00 -070065 pass
66
Yuheng Long26ec76c2013-07-11 07:49:01 -070067 def SetImage(self, image):
Yuheng Longf20cffa2013-06-03 18:46:00 -070068 pass