sbsv2/raptor/python/raptor_timing.py
author yiluzhu
Fri, 30 Apr 2010 16:13:07 +0100
branchfix
changeset 496 50b7c0278040
parent 30 01c962c3f631
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
     1
#
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
     2
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
     3
# All rights reserved.
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
     4
# This component and the accompanying materials are made available
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
     6
# which accompanies this distribution, and is available
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
     8
#
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
     9
# Initial Contributors:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    10
# Nokia Corporation - initial contribution.
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    11
#
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    12
# Contributors:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    13
#
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    14
# Description: 
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    15
# timings API
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    16
# This API can be used to start and stop timings in order to measure performance
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    17
#
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    18
import time
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    19
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    20
class Timing(object):
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    21
	
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    22
	@classmethod
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    23
	def discovery_string(cls, object_type, count):
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    24
		"""
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    25
			Returns a tag that can be used to show what is about to be
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    26
					"processed"
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    27
			Parameters:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    28
				object_type - string
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    29
					Type of object that is about to be "processed" in this task
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    30
				count - int
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    31
					Number of objects of input "object_type" are about to be
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    32
							"processed"
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    33
			Returns:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    34
				string
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    35
					XML tag in the format that can be printed directly to a
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    36
							Raptor log
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    37
		"""
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    38
		return "<progress:discovery object_type='" + str(object_type) + \
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    39
				"' count='" + str(count) + "' />\n"
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    40
				
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    41
	
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    42
	@classmethod
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    43
	def start_string(cls, object_type, task, key):
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    44
		"""
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    45
			Returns a tag that can be used to show what is being "processed"
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    46
					and the time it started
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    47
			Parameters:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    48
				object_type - string
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    49
					Type of object that is being "processed" in this task
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    50
				task - string
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    51
					What is being done with the object being "processed"
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    52
				key - string
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    53
					Unique identifier for the object being "processed"
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    54
			Returns:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    55
				string
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    56
					XML tag in the format that can be printed directly to a
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    57
							Raptor log
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    58
		"""
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    59
		return "<progress:start object_type='" + str(object_type) + \
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    60
				"' task='" + str(task) + "' key='" + str(key) + \
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    61
				"' time='" + str(time.time()) + "' />\n"
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    62
	
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    63
	
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    64
	@classmethod
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    65
	def end_string(cls, object_type, task, key):
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    66
		"""
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    67
			Returns a tag that can be used to show what was being "processed"
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    68
					and the time it finished
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    69
			Parameters:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    70
				object_type - string
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    71
					Type of object that was being "processed" in this task
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    72
				task - string
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    73
					What was being done with the object being "processed"
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    74
				key - string
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    75
					Unique identifier for the object that was "processed"
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    76
			Returns:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    77
				string
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    78
					XML tag in the format that can be printed directly to a
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    79
							Raptor log
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    80
		"""
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    81
		return "<progress:end object_type='" + str(object_type) + \
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    82
				"' task='" + str(task) + "' key='" + str(key) + \
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    83
				"' time='" + str(time.time()) + "' />\n"
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    84
	
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    85
	
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    86
	@classmethod
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    87
	def custom_string(cls, tag = "duration", object_type = "all", task = "all",
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    88
			key = "all", time = 0.0):
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    89
		"""
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    90
			Returns a custom tag in the 'progress' tag format
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    91
			
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    92
			Parameters:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    93
				tag - string
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    94
					String to be used for the tag 
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    95
				object_type - string
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    96
					Type of object that was being "processed" in this task
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    97
				task - string
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    98
					What was being done with the object being "processed"
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
    99
				key - string
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   100
					Unique identifier for the object that was "processed"
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   101
				time - float
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   102
					The time to be included in the tag
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   103
			Returns:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   104
				string
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   105
					XML tag in the format that can be printed directly to a
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   106
							Raptor log
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   107
		"""		
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   108
		time_string = "time"
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   109
		if tag == "duration":
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   110
			time_string = "duration" 
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   111
		return "<progress:" + str(tag) + " object_type='" + str(object_type) + \
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   112
				"' task='" + str(task) + "' key='" + str(key) + \
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   113
				"' " + time_string + "='" + str(time) + "' />\n"
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   114
	
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   115
	
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   116
	@classmethod
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   117
	def extract_values(cls, source):
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   118
		"""
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   119
			Takes, as input, a single tag of the format returned by one of the
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   120
					above progress functions. Will extract the attributes and
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   121
					return them as a dictionary. Returns an empty dictionary {}
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   122
					if the tag name is not recognised or there is a parse error
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   123
			Parameters:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   124
				source - string
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   125
					The input string from which extracted attributes are
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   126
							required
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   127
			Returns:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   128
				dictionary
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   129
					Dictionary containing the attributes extracted from the
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   130
							input string. Returns an empty dictionary {} if the
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   131
							tag name is not recognised or there is a parse error
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   132
			NB: This function will not work correctly if the 'source' variable
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   133
					contains multiple tags
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   134
		"""
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   135
		import re
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   136
		
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   137
		attributes = {}
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   138
					
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   139
		try:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   140
			match = re.match(re.compile(".*object_type='(?P<object_type>.*?)'"),
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   141
					source)
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   142
			attributes["object_type"] = match.group("object_type")
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   143
		except AttributeError, e:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   144
			print e
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   145
			attributes["object_type"] = ""
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   146
		try:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   147
			match = re.match(re.compile(".*task='(?P<task>.*?)'"), source)
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   148
			attributes["task"] = match.group("task")
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   149
		except AttributeError, e:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   150
			print e
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   151
			attributes["task"] = ""
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   152
		try:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   153
			match = re.match(re.compile(".*key='(?P<key>.*?)'"), source)
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   154
			attributes["key"] = match.group("key")
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   155
		except AttributeError:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   156
			attributes["key"] = ""
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   157
		try:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   158
			match = re.match(re.compile(".*time='(?P<time>.*?)'"), source)
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   159
			attributes["time"] = match.group("time")
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   160
		except AttributeError:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   161
			attributes["time"] = ""
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   162
		try:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   163
			match = re.match(re.compile(".*count='(?P<count>.*?)'"), source)
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   164
			attributes["count"] = match.group("count")
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   165
		except AttributeError:
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   166
			attributes["count"] = ""
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   167
			
01c962c3f631 correction: left out timing files in previous commit
timothy.murphy@nokia.com
parents:
diff changeset
   168
		return attributes