The Object Management Group (OMG) is in the process of defining a UML Profile for Schedulability, Performance and Time that will enable the construction of models for making quantitative predictions regarding these characteristics. The paper proposes a graph-grammar based method for transforming automatically a UML model annotated with performance information into a Layered Queueing Network (LQN) performance model. The input to our transformation algorithm is an XML file that contains the UML model in XML format according to the standard XMI interface. The output is the corresponding LQN model description file, which can be read directly by existing LQN solvers. The LQN model structure is generated from the high-level software architecture and from deployment diagrams indicating the allocation of software components to hardware devices. The LQN model parameters are obtained from detailed models of key performance scenarios, represented as UML interaction or activity diagrams.