Blame optimization-guide/sv/sv.po

Packit 1470ea
# Swedish translation for gnome-devel-docs.
Packit 1470ea
# Copyright © 2015 gnome-devel-docs's COPYRIGHT HOLDER
Packit 1470ea
# This file is distributed under the same license as the gnome-devel-docs package.
Packit 1470ea
# Anders Jonsson <anders.jonsson@norsjovallen.se>, 2015.
Packit 1470ea
#
Packit 1470ea
msgid ""
Packit 1470ea
msgstr ""
Packit 1470ea
"Project-Id-Version: gnome-devel-docs master\n"
Packit 1470ea
"POT-Creation-Date: 2016-02-02 20:55+0000\n"
Packit 1470ea
"PO-Revision-Date: 2016-02-03 00:36+0100\n"
Packit 1470ea
"Last-Translator: Anders Jonsson <anders.jonsson@norsjovallen.se>\n"
Packit 1470ea
"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
Packit 1470ea
"Language: sv\n"
Packit 1470ea
"MIME-Version: 1.0\n"
Packit 1470ea
"Content-Type: text/plain; charset=UTF-8\n"
Packit 1470ea
"Content-Transfer-Encoding: 8bit\n"
Packit 1470ea
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
Packit 1470ea
"X-Generator: Poedit 1.8.6\n"
Packit 1470ea
Packit 1470ea
#. Put one translator per line, in the form NAME <EMAIL>, YEAR1, YEAR2
Packit 1470ea
msgctxt "_"
Packit 1470ea
msgid "translator-credits"
Packit 1470ea
msgstr "Anders Jonsson <anders.jonsson@norsjovallen.se>, 2015"
Packit 1470ea
Packit 1470ea
#. (itstool) path: page/title
Packit 1470ea
#: C/harmful.page:7
Packit 1470ea
msgid "Disk Seeks Considered Harmful"
Packit 1470ea
msgstr "Disksökningar ansedda skadliga"
Packit 1470ea
Packit 1470ea
#. (itstool) path: page/p
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/harmful.page:8 C/index.page:54
Packit 1470ea
msgid ""
Packit 1470ea
"Disk seeks are one of the most expensive operations you can possibly "
Packit 1470ea
"perform. You might not know this from looking at how many of them we "
Packit 1470ea
"perform, but trust me, they are. Consequently, please refrain from the "
Packit 1470ea
"following suboptimal behavior:"
Packit 1470ea
msgstr ""
Packit 1470ea
"Disksökningar är en av de dyraste operationerna du kan utföra. Det kan vara "
Packit 1470ea
"svårt att inse om man betänker hur många av dem vi utför, men tro mig, det "
Packit 1470ea
"är de. Försök därför hålla dig från följande ej optimala beteende:"
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/harmful.page:13
Packit 1470ea
msgid "Placing lots of small files all over the disk."
Packit 1470ea
msgstr "Placera massor av små filer över hela disken."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/harmful.page:18
Packit 1470ea
msgid "Opening, stating, and reading lots of files all over the disk"
Packit 1470ea
msgstr "Öppna, köra ”stat” på och läsa ett stort antal filer över hela disken"
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/harmful.page:23
Packit 1470ea
msgid ""
Packit 1470ea
"Doing the above on files that are laid out at different times, so as to "
Packit 1470ea
"ensure that they are fragmented and cause even more seeking."
Packit 1470ea
msgstr ""
Packit 1470ea
"Göra det ovanstående på filer som lagts ut vid olika tidpunkter, så att de "
Packit 1470ea
"säkert är fragmenterade och orsakar än mer sökning."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/harmful.page:28
Packit 1470ea
msgid ""
Packit 1470ea
"Doing the above on files that are in different directories, so as to ensure "
Packit 1470ea
"that they are in different cylinder groups and cause even more seeking."
Packit 1470ea
msgstr ""
Packit 1470ea
"Göra det ovanstående på filer som är i olika kataloger, så att de säkert är "
Packit 1470ea
"i olika cylindergrupper och orsakar än mer sökning."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/harmful.page:33
Packit 1470ea
msgid "Repeatedly doing the above when it only needs to be done once."
Packit 1470ea
msgstr "Att upprepat göra det ovanstående då det bara behöver göras en gång."
Packit 1470ea
Packit 1470ea
#. (itstool) path: page/p
Packit 1470ea
#: C/harmful.page:38
Packit 1470ea
msgid "Ways in which you can optimize your code to be seek-friendly:"
Packit 1470ea
msgstr "Vägar på vilket du kan optimera din kod att bli mer sökvänlig:"
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/harmful.page:43
Packit 1470ea
msgid "Consolidate data into a single file."
Packit 1470ea
msgstr "Samla data i en enda fil."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/harmful.page:48
Packit 1470ea
msgid "Keep data together in the same directory."
Packit 1470ea
msgstr "Håll data samlat i samma katalog."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/harmful.page:53
Packit 1470ea
msgid "Cache data so as to not need to reread constantly."
Packit 1470ea
msgstr "Cacha data så att det inte konstant behöver läsas om."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/harmful.page:58
Packit 1470ea
msgid ""
Packit 1470ea
"Share data so as not to have to reread it from disk when each application "
Packit 1470ea
"loads."
Packit 1470ea
msgstr ""
Packit 1470ea
"Dela data så att det inte behöver läsas om från disk då varje program läses "
Packit 1470ea
"in."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/harmful.page:63
Packit 1470ea
msgid ""
Packit 1470ea
"Consider caching all of the data in a single binary file that is properly "
Packit 1470ea
"aligned and can be mmaped."
Packit 1470ea
msgstr ""
Packit 1470ea
"Överväg att cacha alla data i en enstaka binärfil som är korrekt justerad "
Packit 1470ea
"och du kan köra mmap på."
Packit 1470ea
Packit 1470ea
#. (itstool) path: page/p
Packit 1470ea
#: C/harmful.page:68
Packit 1470ea
msgid ""
Packit 1470ea
"The trouble with disk seeks are compounded for reads, which is unfortunately "
Packit 1470ea
"what we are doing. Remember, reads are generally synchronous while writes "
Packit 1470ea
"are asynchronous. This only compounds the problem, serializing each read, "
Packit 1470ea
"and contributing to program latency."
Packit 1470ea
msgstr ""
Packit 1470ea
"Problemet med disksökningar förvärras för läsningar, vilket dessvärre är vad "
Packit 1470ea
"vi gör. Kom ihåg att läsningar generellt är synkrona medan skrivningar är "
Packit 1470ea
"asynkrona. Detta förvärrar bara problemet, serialiserar varje läsning och "
Packit 1470ea
"bidrar till programlatens."
Packit 1470ea
Packit 1470ea
#. (itstool) path: license/p
Packit 1470ea
#: C/index.page:7
Packit 1470ea
msgid ""
Packit 1470ea
"Permission is granted to copy, distribute and/or modify this document under "
Packit 1470ea
"the terms of the GNU Free Documentation License, Version 1.1 or any later "
Packit 1470ea
"version published by the Free Software Foundation with no Invariant "
Packit 1470ea
"Sections, no Front-Cover Texts, and no Back-Cover Texts. You may obtain a "
Packit 1470ea
"copy of the GNU Free Documentation License from the Free Software Foundation "
Packit 1470ea
"by visiting <link href=\"http://www.fsf.org\">their Web site</link> or by "
Packit 1470ea
"writing to: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor "
Packit 1470ea
"Boston, MA 02110-1335, USA."
Packit 1470ea
msgstr ""
Packit 1470ea
"Tillstånd att kopiera, distribuera och/eller modifiera detta dokument ges "
Packit 1470ea
"under villkoren i GNU Free Documentation License, version 1.1 eller senare, "
Packit 1470ea
"utgivet av Free Software Foundation utan standardavsnitt och omslagstexter.  "
Packit 1470ea
"Du kan erhålla en kopia av GNU Free Documentation License från Free Software "
Packit 1470ea
"Foundation genom att besöka <link href=\"http://www.fsf.org\">deras "
Packit 1470ea
"webbplats</link> eller genom att skriva till: Free Software Foundation, "
Packit 1470ea
"Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1335, USA."
Packit 1470ea
Packit 1470ea
#. (itstool) path: license/p
Packit 1470ea
#: C/index.page:16
Packit 1470ea
msgid ""
Packit 1470ea
"Many of the names used by companies to distinguish their products and "
Packit 1470ea
"services are claimed as trademarks. Where those names appear in any GNOME "
Packit 1470ea
"documentation, and those trademarks are made aware to the members of the "
Packit 1470ea
"GNOME Documentation Project, the names have been printed in caps or initial "
Packit 1470ea
"caps."
Packit 1470ea
msgstr ""
Packit 1470ea
"Många av namnen som används av företag för att skilja på deras produkter och "
Packit 1470ea
"tjänster är registrerade varumärken. I de fall dessa namn förekommer i GNOME-"
Packit 1470ea
"dokumentation - och medlemmarna i GNOME-dokumentationsprojektet är medvetna "
Packit 1470ea
"om dessa varumärken - är de skrivna med versaler eller med inledande versal."
Packit 1470ea
Packit 1470ea
#. (itstool) path: credit/years
Packit 1470ea
#: C/index.page:24 C/index.page:28
Packit 1470ea
msgid "2004-2005"
Packit 1470ea
msgstr "2004-2005"
Packit 1470ea
Packit 1470ea
#. (itstool) path: credit/name
Packit 1470ea
#: C/index.page:25
Packit 1470ea
msgid "Callum McKenzie"
Packit 1470ea
msgstr "Callum McKenzie"
Packit 1470ea
Packit 1470ea
#. (itstool) path: credit/name
Packit 1470ea
#: C/index.page:29
Packit 1470ea
msgid "Robert Love"
Packit 1470ea
msgstr "Robert Love"
Packit 1470ea
Packit 1470ea
#. (itstool) path: info/desc
Packit 1470ea
#: C/index.page:32
Packit 1470ea
msgid ""
Packit 1470ea
"Software can be optimized in many ways: for speed, program size, or memory "
Packit 1470ea
"use. This section contains guides and tutorials for optimizing your software."
Packit 1470ea
msgstr ""
Packit 1470ea
"Programvara kan optimeras på många sätt: för hastighet, programstorlek eller "
Packit 1470ea
"minnesanvändning. Detta avsnitt innehåller guider och handledningar för att "
Packit 1470ea
"optimera din programvara."
Packit 1470ea
Packit 1470ea
#. (itstool) path: page/title
Packit 1470ea
#: C/index.page:35
Packit 1470ea
msgid "Optimization Guide"
Packit 1470ea
msgstr "Optimeringsguide"
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/title
Packit 1470ea
#: C/index.page:38 C/massif.page:12
Packit 1470ea
msgid "Introduction"
Packit 1470ea
msgstr "Introduktion"
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/index.page:39
Packit 1470ea
msgid ""
Packit 1470ea
"This is a brief introduction to optimization, both the hows and the whys. "
Packit 1470ea
"Details of individual tools and techniques are left for later articles, but "
Packit 1470ea
"a collection of hints and tricks is provided."
Packit 1470ea
msgstr ""
Packit 1470ea
"Detta är en kort inledning till optimering, både hur och varför det görs. "
Packit 1470ea
"Detaljer kring enskilda verktyg och tekniker lämnas till senare artiklar, "
Packit 1470ea
"men en samling tips och knep tillhandahålls."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/title
Packit 1470ea
#: C/index.page:45
Packit 1470ea
msgid "Massif"
Packit 1470ea
msgstr "Massif"
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#. (itstool) path: page/p
Packit 1470ea
#: C/index.page:46 C/massif.page:9
Packit 1470ea
msgid ""
Packit 1470ea
"This article describes how to use the <app>Massif</app> heap profiler with "
Packit 1470ea
"GNOME applications. We describe how to invoke, interpret, and act on the "
Packit 1470ea
"output of <app>Massif</app>. The <app>Swell Foop</app> game is used as an "
Packit 1470ea
"example."
Packit 1470ea
msgstr ""
Packit 1470ea
"Denna artikel beskriver hur heap-profileraren <app>Massif</app> kan användas "
Packit 1470ea
"med GNOME-program. Vi beskriver hur du kan köra, tolka och reagera på utdata "
Packit 1470ea
"från <app>Massif</app>. Spelet <app>Swell Foop</app> används som ett exempel."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/title
Packit 1470ea
#: C/index.page:53
Packit 1470ea
msgid "Harmfulness"
Packit 1470ea
msgstr "Skadlighet"
Packit 1470ea
Packit 1470ea
#. (itstool) path: page/title
Packit 1470ea
#: C/introduction.page:7
Packit 1470ea
msgid "What are we Optimizing?"
Packit 1470ea
msgstr "Vad optimerar vi?"
Packit 1470ea
Packit 1470ea
#. (itstool) path: page/p
Packit 1470ea
#: C/introduction.page:8
Packit 1470ea
msgid ""
Packit 1470ea
"When we optimize for GNOME the first thing to remember is this: we are not "
Packit 1470ea
"trying to make the program better, we are trying to make the person using "
Packit 1470ea
"the computer happier."
Packit 1470ea
msgstr ""
Packit 1470ea
"När vi optimerar för GNOME är den första saken att komma ihåg detta: vi "
Packit 1470ea
"försöker inte göra programmet bättre, vi försöker göra personen som använder "
Packit 1470ea
"datorn gladare."
Packit 1470ea
Packit 1470ea
#. (itstool) path: page/p
Packit 1470ea
#: C/introduction.page:10
Packit 1470ea
msgid ""
Packit 1470ea
"Better programs make people happier, but there are some improvements that "
Packit 1470ea
"will make them a lot happier than others: Responsiveness, start-up time, "
Packit 1470ea
"easy to access commands and not having the computer go into swap the moment "
Packit 1470ea
"more than two programs are open."
Packit 1470ea
msgstr ""
Packit 1470ea
"Bättre program gör folk gladare, men det finns några förbättringar som "
Packit 1470ea
"kommer göra dem mycket gladare än andra: svarstid, uppstartstid, "
Packit 1470ea
"lättåtkomliga kommandon och att datorn inte övergår till växlingsminne så "
Packit 1470ea
"fort fler än två program är öppna."
Packit 1470ea
Packit 1470ea
#. (itstool) path: page/p
Packit 1470ea
#: C/introduction.page:13
Packit 1470ea
msgid ""
Packit 1470ea
"Traditional optimization tackles concepts like CPU use, code size, the "
Packit 1470ea
"number of mouse clicks and the memory use of the program. This second list "
Packit 1470ea
"has been chosen to correlate with the first list, however there is an "
Packit 1470ea
"important difference: The person using GNOME doesn't care about the second "
Packit 1470ea
"list, but they care a lot about the first list. When optimizing GNOME "
Packit 1470ea
"programs we will reduce CPU use, memory use and all those things, but these "
Packit 1470ea
"are the means to the end, not the final goal. We are optimizing for people."
Packit 1470ea
msgstr ""
Packit 1470ea
"Traditionell optimering behandlar koncept som CPU-användning, kodstorlek, "
Packit 1470ea
"antalet musklick och minnesanvändningen för programmet. Denna andra lista "
Packit 1470ea
"har valts för att korrelera med den första listan, men det finns en viktig "
Packit 1470ea
"skillnad: Personen som använder GNOME bryr sig inte om den andra listan, "
Packit 1470ea
"medan de bryr sig mycket om den första listan. Då vi optimerar GNOME-program "
Packit 1470ea
"kommer vi minska CPU-användning, minnesanvändning och alla de sakerna, men "
Packit 1470ea
"dessa är medel för att nå målet, de är inte målet i sig. Vi optimerar för "
Packit 1470ea
"människor."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/title
Packit 1470ea
#: C/introduction.page:18
Packit 1470ea
msgid "Doing the Optimization"
Packit 1470ea
msgstr "Göra optimeringen"
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/introduction.page:19
Packit 1470ea
msgid ""
Packit 1470ea
"The previous section omitted one important qualifier: To optimize something "
Packit 1470ea
"it has to be measurable. You can't measure happiness. However, you can "
Packit 1470ea
"measure start-up time so you can tell if you have improved it. Happiness "
Packit 1470ea
"will then, hopefully, follow."
Packit 1470ea
msgstr ""
Packit 1470ea
"Det föregående avsnittet förbisåg en viktig egenskap: för att optimera något "
Packit 1470ea
"måste det vara mätbart. Du kan inte mäta glädje. Om du mäter uppstartstid "
Packit 1470ea
"kan du dock se om du har förbättrat den. Förhoppningsvis kommer även glädje "
Packit 1470ea
"att följa på detta."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/introduction.page:22
Packit 1470ea
msgid ""
Packit 1470ea
"Optimization is the process of measurement, refinement and re-measurement. "
Packit 1470ea
"So the first thing you must do is find a way to measure what you are "
Packit 1470ea
"optimizing. Ideally this measurement is a single number, for example: the "
Packit 1470ea
"time taken to perform a task. This is your benchmark, it is the only way to "
Packit 1470ea
"tell if you are winning or losing. There is a big difference between a "
Packit 1470ea
"program that should be fast and a program that is fast."
Packit 1470ea
msgstr ""
Packit 1470ea
"Optimering är en process bestående av mätning, förfining och ny mätning. Det "
Packit 1470ea
"första du måste göra är alltså att hitta ett sätt att mäta det som du "
Packit 1470ea
"optimerar. I idealfallet är detta mätvärde en enda siffra, till exempel "
Packit 1470ea
"tiden för att utföra en viss uppgift. Detta är ditt prestandatest, det är "
Packit 1470ea
"det enda sättet att avgöra om du vinner eller förlorar. Det är stor skillnad "
Packit 1470ea
"mellan ett program som borde vara snabbt och ett program som "
Packit 1470ea
"är snabbt."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/introduction.page:25
Packit 1470ea
msgid ""
Packit 1470ea
"Once you have a basic benchmark you need to find out why your code is not "
Packit 1470ea
"doing as well as it should. It is tempting to do this by inspection: just "
Packit 1470ea
"looking at the code and trying to spot something that looks like it needs "
Packit 1470ea
"improvement. You will invariably be wrong. Using a profiler to get a "
Packit 1470ea
"detailed break-down of what your program really does is the only way to be "
Packit 1470ea
"sure."
Packit 1470ea
msgstr ""
Packit 1470ea
"Då du väl har ett grundläggande prestandatest behöver du komma på varför din "
Packit 1470ea
"kod inte fungerar så bra som den borde. Det är frestande att göra detta via "
Packit 1470ea
"inspektion: att bara titta på koden och försöka hitta något som ser ut som "
Packit 1470ea
"att det behöver förbättras. Du kommer helt säkert ha fel. Att använda en "
Packit 1470ea
"profilerare för att få en detaljerad sammanställning över vad ditt program "
Packit 1470ea
"verkligen gör är enda sättet att vara säker."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/introduction.page:28
Packit 1470ea
msgid ""
Packit 1470ea
"Usually the problem is isolated to small sections of code. Pick the worst "
Packit 1470ea
"place and concentrate on that first. Once that is done, rerun the profiler "
Packit 1470ea
"and repeat. As you proceed the gains made at each step will get less and "
Packit 1470ea
"less, at some point you will have to decide that the results are good "
Packit 1470ea
"enough. If your efforts are only extracting 10% improvements then you are "
Packit 1470ea
"well past the point where you should have stopped."
Packit 1470ea
msgstr ""
Packit 1470ea
"Vanligen är problemet isolerat till små stycken kod. Välj det värsta stället "
Packit 1470ea
"och koncentrera dig på det först. Då det väl är klart kan du köra om "
Packit 1470ea
"profileraren och upprepa proceduren. Då du fortsätter kommer vinsterna du "
Packit 1470ea
"gör i varje steg bli mindre och mindre, och vid någon punkt måste du avgöra "
Packit 1470ea
"om resultaten är bra nog. Om dina ansträngningar endast orsakar "
Packit 1470ea
"förbättringar på 10% är du sedan länge förbi punkten då du borde ha slutat."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/introduction.page:31
Packit 1470ea
msgid ""
Packit 1470ea
"Don't forget the big picture. For example, rather than just trying to speed "
Packit 1470ea
"up a piece of code, ask yourself if it needs to be run at all. Could it be "
Packit 1470ea
"combined with another piece of code? Can the results of previous "
Packit 1470ea
"calculations be saved and reused? It won't even need to be optimized if it "
Packit 1470ea
"is in a place where the user is never going to notice it. Worse still, the "
Packit 1470ea
"code may already be optimized and is doing the heavy calculations now to "
Packit 1470ea
"avoid doing them later. Code does not run in isolation and neither does the "
Packit 1470ea
"optimization process."
Packit 1470ea
msgstr ""
Packit 1470ea
"Glöm inte helhetsbilden. Till exempel kan du istället för att försöka göra "
Packit 1470ea
"ett stycke kod snabbare fråga dig själv om det över huvud taget behöver "
Packit 1470ea
"köras. Kan det kombineras med annan kod? Kan resultatet från tidigare "
Packit 1470ea
"beräkningar sparas och återanvändas? Det behöver inte ens optimeras om det "
Packit 1470ea
"är på ett ställe så att användaren aldrig kommer att upptäcka det. "
Packit 1470ea
"Optimeringsförsök är än värre om koden redan är optimerad och gör de tunga "
Packit 1470ea
"beräkningarna nu för att undvika att göra dem senare. Kod körs inte "
Packit 1470ea
"isolerad, och detsamma gäller även optimeringsprocessen."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/title
Packit 1470ea
#: C/introduction.page:37
Packit 1470ea
msgid "Hints"
Packit 1470ea
msgstr "Tips"
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/title
Packit 1470ea
#: C/introduction.page:41
Packit 1470ea
msgid "The Fundamentals"
Packit 1470ea
msgstr "Grunderna"
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:44
Packit 1470ea
msgid ""
Packit 1470ea
"Re-run your benchmark after every change you make to the code and keep a log "
Packit 1470ea
"of everything you change and how it affects the benchmark. This lets you "
Packit 1470ea
"undo mistakes and also helps you not to repeat mistakes."
Packit 1470ea
msgstr ""
Packit 1470ea
"Kör om ditt prestandatest efter varje ändring du gör i koden och behåll en "
Packit 1470ea
"logg över allt du ändrar och hur det påverkar prestandatestet. Detta låter "
Packit 1470ea
"dig göra misstag ogjorda och hjälper dig även att inte upprepa misstag."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:49
Packit 1470ea
msgid ""
Packit 1470ea
"Make sure your code is correct and bug-free before optimizing it. Check that "
Packit 1470ea
"it remains correct and bug-free after optimization."
Packit 1470ea
msgstr ""
Packit 1470ea
"Försäkra dig om att din kod är korrekt och felfri innan du optimerar den. "
Packit 1470ea
"Kontrollera att den förblir korrekt och felfri efter optimering."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:54
Packit 1470ea
msgid "Optimize at the high level before optimizing the details."
Packit 1470ea
msgstr "Optimera på hög nivå innan du optimerar detaljerna."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:59
Packit 1470ea
msgid ""
Packit 1470ea
"Use the right algorithm. The classic text-book example is using quick-sort "
Packit 1470ea
"instead of bubble-sort. There are many others, some save memory, some save "
Packit 1470ea
"CPU. Also, see what shortcuts you can make: you can do quicker than quick-"
Packit 1470ea
"sort if you are prepared to make some compromises."
Packit 1470ea
msgstr ""
Packit 1470ea
"Använd rätt algoritm. Det klassiska skolboksexemplet är att använda "
Packit 1470ea
"kvicksortering istället för bubbelsortering. Det finns många andra, vissa "
Packit 1470ea
"sparar minne, andra sparar CPU. Se även vad du kan ta för genvägar: du kan "
Packit 1470ea
"sortera snabbare än kvicksortering om du är redo att göra kompromisser."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:64
Packit 1470ea
msgid ""
Packit 1470ea
"Optimization is a trade-off. Caching results speeds up calculations, but "
Packit 1470ea
"increases memory use. Saving data to disk saves memory, but costs time when "
Packit 1470ea
"it is loaded back from disk."
Packit 1470ea
msgstr ""
Packit 1470ea
"Optimering är en avvägning. Att cacha resultat snabbar upp beräkningar, men "
Packit 1470ea
"ökar minnesanvändning. Att spara data till disk sparar minne, men kostar tid "
Packit 1470ea
"då det läses tillbaka från disken."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:69
Packit 1470ea
msgid ""
Packit 1470ea
"Make sure you choose a wide variety of inputs to optimize against. If you "
Packit 1470ea
"don't it is easy to end up with a piece of code carefully optimized for one "
Packit 1470ea
"file and no others."
Packit 1470ea
msgstr ""
Packit 1470ea
"Säkerställ att du väljer en bred mångfald av indata att optimera mot. Om du "
Packit 1470ea
"inte gör detta är det lätt hänt att du i slutändan har kod som är noggrant "
Packit 1470ea
"optimerad mot en fil och inga andra."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:74
Packit 1470ea
msgid ""
Packit 1470ea
"Avoid expensive operations: Multiple small disk reads. Using up lots of "
Packit 1470ea
"memory so disk swapping becomes necessary. Avoid anything that writes or "
Packit 1470ea
"reads from the hard disk unnecessarily. The network is slow too. Also avoid "
Packit 1470ea
"graphics operations that need a response from the X server."
Packit 1470ea
msgstr ""
Packit 1470ea
"Undvik dyra operationer: många små diskläsningar. Att använda upp mycket "
Packit 1470ea
"minne så att användning av växlingsminne blir nödvändig. Undvik allt som "
Packit 1470ea
"skriver till eller läser från hårddisken i onödan. Nätverket är också "
Packit 1470ea
"långsamt. Undvik även grafikåtgärder som behöver ett svar från X-servern."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/title
Packit 1470ea
#: C/introduction.page:81
Packit 1470ea
msgid "Traps for the Unwary"
Packit 1470ea
msgstr "Fällor för den oförsiktige"
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:84
Packit 1470ea
msgid ""
Packit 1470ea
"Beware of side effects. There can often be strange interactions between "
Packit 1470ea
"different sections of code, a speed-up in one part can slow another part "
Packit 1470ea
"down."
Packit 1470ea
msgstr ""
Packit 1470ea
"Var uppmärksam på sidoeffekter. Det kan ofta finnas märkliga interaktioner "
Packit 1470ea
"mellan olika stycken kod, en hastighetsökning i en del kan sakta ner en "
Packit 1470ea
"annan del."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:89
Packit 1470ea
msgid ""
Packit 1470ea
"When timing code, even on a quiet system, events outside the program add "
Packit 1470ea
"noise to the timing results. Average over multiple runs. If the code is very "
Packit 1470ea
"short, timer resolution is also a problem. In this case measure the time the "
Packit 1470ea
"computer takes to run the code 100 or 1000 times. If the times you are "
Packit 1470ea
"recording are longer than a few seconds, you should be OK."
Packit 1470ea
msgstr ""
Packit 1470ea
"När du tar tid på kod så bidrar händelser utanför programmet till störningar "
Packit 1470ea
"till tidtagningsresultaten, detta även på ett system i vila. Ta ett "
Packit 1470ea
"genomsnitt över flera körningar. Om koden är väldigt kort är även "
Packit 1470ea
"upplösningen på tidsberäkningen ett problem. I detta fall får du mäta tiden "
Packit 1470ea
"datorn tar för att köra koden 100 eller 1000 gånger. Om tiderna du mäter är "
Packit 1470ea
"längre än några få sekunder är det troligen OK."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:94
Packit 1470ea
msgid ""
Packit 1470ea
"It is very easy to be misled by the profiler. There are stories of people "
Packit 1470ea
"optimizing the operating system idle-loop because that is where it spent all "
Packit 1470ea
"its time! Don't optimize code that does nothing the user cares about."
Packit 1470ea
msgstr ""
Packit 1470ea
"Det är lätt att bli vilseledd av profileraren. Det finns historier om folk "
Packit 1470ea
"som optimerat operativsystemets viloslinga för att det är där det "
Packit 1470ea
"tillbringar all sin tid! Optimera inte kod som inte gör något användaren är "
Packit 1470ea
"intresserad av."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:99
Packit 1470ea
msgid ""
Packit 1470ea
"Remember the resources on the X server. Your program's memory usage doesn't "
Packit 1470ea
"include the pixmaps that are stored in the X server's process, but they are "
Packit 1470ea
"still using up memory. Use xrestop to see what resources your program is "
Packit 1470ea
"using."
Packit 1470ea
msgstr ""
Packit 1470ea
"Kom ihåg resurserna på X-servern. Ditt programs minnesanvändning inkluderar "
Packit 1470ea
"inte pixmappar som lagras i X-serverns process, men de använder fortfarande "
Packit 1470ea
"minne. Använd xrestop för att se vilka resurser ditt program använder."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/title
Packit 1470ea
#: C/introduction.page:106
Packit 1470ea
msgid "Low Level Hints"
Packit 1470ea
msgstr "Tips på låg nivå"
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:109
Packit 1470ea
msgid ""
Packit 1470ea
"When optimizing memory use, be wary of the difference between peak usage and "
Packit 1470ea
"average memory usage. Some memory is almost always allocated, this is "
Packit 1470ea
"usually bad. Some is only briefly allocated, this may be quite acceptable. "
Packit 1470ea
"Tools like massif use the concept of space-time, the product of memory used "
Packit 1470ea
"and the duration it was allocated for, instead."
Packit 1470ea
msgstr ""
Packit 1470ea
"När du optimerar minnesanvändning får du vara uppmärksam på skillnaden "
Packit 1470ea
"mellan maximal användning och genomsnittlig minnesanvändning. Visst minne är "
Packit 1470ea
"nästan alltid allokerat, detta är oftast dåligt. Annat är bara allokerat "
Packit 1470ea
"kort tid, detta kan vara acceptabelt. Verktyg som massif använder istället "
Packit 1470ea
"konceptet utrymmestid, produkten av använt minne och tidslängden det var "
Packit 1470ea
"allokerat."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:114
Packit 1470ea
msgid ""
Packit 1470ea
"Time simplified bits of code that do only the things you know are essential, "
Packit 1470ea
"this gives an absolute lower limit on the time your code will take. For "
Packit 1470ea
"example, when optimizing a loop time the empty loop. If that is still too "
Packit 1470ea
"long no amount of micro-optimization will help and you will have to change "
Packit 1470ea
"your design. Make sure the compiler doesn't optimize away your empty loop."
Packit 1470ea
msgstr ""
Packit 1470ea
"Ta tid på förenklade kodstycken som endast gör de väsentliga sakerna, detta "
Packit 1470ea
"ger dig en absolut lägre gräns på tiden din kod kommer ta. Om du till "
Packit 1470ea
"exempel optimerar en slinga kan du ta tid på en tom slinga. Om detta "
Packit 1470ea
"fortfarande tar för lång tid kan ingen mikrooptimering hjälpa dig, och du "
Packit 1470ea
"måste ändra din design. Säkerställ att kompilatorn inte optimerar bort din "
Packit 1470ea
"tomma slinga."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:119
Packit 1470ea
msgid ""
Packit 1470ea
"Move code out from inside loops. A slightly more complicated piece of code "
Packit 1470ea
"that is executed once is far quicker than a simple piece of code executed a "
Packit 1470ea
"thousand times. Avoid calling slow code often."
Packit 1470ea
msgstr ""
Packit 1470ea
"Flytta ut kod som är i slingor. En något mer komplicerad kod som körs en "
Packit 1470ea
"gång är mycket snabbare än ett enkelt kodstycke som körs tusen gånger. "
Packit 1470ea
"Undvik att anropa långsam kod ofta."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:124
Packit 1470ea
msgid ""
Packit 1470ea
"Give the compiler as many hints as possible. Use the const keyword. Use "
Packit 1470ea
"G_INLINE_FUNC for short, frequently called, functions. Look up "
Packit 1470ea
"G_GNUC_PURE, G_LIKELY and the other glib "
Packit 1470ea
"miscellaneous macros. Use the macros instead of gcc-specific keywords to "
Packit 1470ea
"ensure portability."
Packit 1470ea
msgstr ""
Packit 1470ea
"Ge kompilatorn så många tips som möjligt. Använd nyckelordet const. Använd "
Packit 1470ea
"G_INLINE_FUNC för korta, ofta anropade, funktioner. Ta en titt "
Packit 1470ea
"på G_GNUC_PURE, G_LIKELY och de andra "
Packit 1470ea
"diversemakrona hos glib. Använd makrona istället för gcc-specifika nyckelord "
Packit 1470ea
"för att säkerställa portabilitet."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:129
Packit 1470ea
msgid ""
Packit 1470ea
"Don't use assembly language. It is not portable and, while it may be fast on "
Packit 1470ea
"one processor, it is not even guaranteed to be fast on every processor that "
Packit 1470ea
"supports that architecture (e.g. Athlon vs. Pentium 4)."
Packit 1470ea
msgstr ""
Packit 1470ea
"Använd inte assemblerspråk. Det är inte porterbart, och även om det kan vara "
Packit 1470ea
"snabbt på en processor så är det inte garanterat att vara snabbt på alla "
Packit 1470ea
"processorer som stöder den arkitekturen (t.ex. Athlon kontra Pentium 4)."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:134
Packit 1470ea
msgid ""
Packit 1470ea
"Don't rewrite an existing library routine unless you are sure it is "
Packit 1470ea
"unnecessarily slow. Many CPU-intensive library routines have already been "
Packit 1470ea
"optimized. Conversely, some library routines are slow, especially ones that "
Packit 1470ea
"make system calls to the operating system."
Packit 1470ea
msgstr ""
Packit 1470ea
"Skriv inte om en existerande biblioteksrutin om du inte är säker på att den "
Packit 1470ea
"är onödigt långsam. Många CPU-intensiva biblioteksrutiner har redan "
Packit 1470ea
"optimerats. Omvänt är vissa biblioteksrutiner långsamma, särskilt sådana som "
Packit 1470ea
"gör systemanrop till operativsystemet."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:139
Packit 1470ea
msgid ""
Packit 1470ea
"Minimize the number of libraries you link to. The fewer libraries to link "
Packit 1470ea
"in, the faster the program starts. This is a difficult thing to do with "
Packit 1470ea
"GNOME."
Packit 1470ea
msgstr ""
Packit 1470ea
"Minimera antalet bibliotek som du länkar till. Ju färre program att länka "
Packit 1470ea
"in, desto snabbare startar programmet. Detta är svårt att göra med GNOME."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/title
Packit 1470ea
#: C/introduction.page:146
Packit 1470ea
msgid "High Level Tricks"
Packit 1470ea
msgstr "Trick på hög nivå"
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:149
Packit 1470ea
msgid ""
Packit 1470ea
"Take advantage of concurrency. This doesn't just mean using multiple "
Packit 1470ea
"processors, it also means taking advantage of the time the user spends "
Packit 1470ea
"thinking about what they are going to do next to perform some calculations "
Packit 1470ea
"in anticipation. Do calculations while waiting for data to be loaded off "
Packit 1470ea
"disk. Take advantage of multiple resources, use them all at once."
Packit 1470ea
msgstr ""
Packit 1470ea
"Dra nytta av samtidighet. Detta betyder inte bara att använda flera "
Packit 1470ea
"processorer, det betyder också att dra nytta av tiden användaren använder "
Packit 1470ea
"för att tänka på vad de ska göra härnäst för att utföra några beräkningar i "
Packit 1470ea
"förväg. Gör beräkningar under väntan på att data ska läsas från disk. Dra "
Packit 1470ea
"nytta av flera resurser, använd dem alla samtidigt."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:154
Packit 1470ea
msgid ""
Packit 1470ea
"Cheat. The user only has to think that the computer is fast, it doesn't "
Packit 1470ea
"matter whether it actually is or not. It is the time between the command and "
Packit 1470ea
"the answer that is important, it doesn't matter if the response is pre-"
Packit 1470ea
"calculated, cached, or will in fact be worked out later at a more convenient "
Packit 1470ea
"time, as long as the user gets what they expect."
Packit 1470ea
msgstr ""
Packit 1470ea
"Fuska. Användaren behöver bara tro att datorn är snabb, det spelar ingen "
Packit 1470ea
"roll om den faktiskt är det eller inte. Det är tiden mellan kommandot och "
Packit 1470ea
"svaret som är viktig, det spelar ingen roll om svaret är beräknat i förväg, "
Packit 1470ea
"cachat, eller faktiskt kommer utarbetas senare vid ett lämpligare tillfälle, "
Packit 1470ea
"så länge användaren får vad de förväntar sig."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:159
Packit 1470ea
msgid ""
Packit 1470ea
"Do things in the idle loop. It is easier to program than using full multi-"
Packit 1470ea
"threading but still gets things done out of the users eye. Be careful "
Packit 1470ea
"though, if you spend too long in the idle loop your program will become "
Packit 1470ea
"sluggish. So regularly give control back to the main loop."
Packit 1470ea
msgstr ""
Packit 1470ea
"Gör saker i viloslingan. Det är enklare att programmera än fullständig "
Packit 1470ea
"flertrådning men får ändå saker gjorda utan att användaren märker det. Var "
Packit 1470ea
"dock försiktig, om du tillbringar för mycket tid i viloslingan kommer ditt "
Packit 1470ea
"program att kännas trögt. Ge därför med jämna mellanrum kontroll tillbaka "
Packit 1470ea
"till huvudslingan."
Packit 1470ea
Packit 1470ea
#. (itstool) path: item/p
Packit 1470ea
#: C/introduction.page:164
Packit 1470ea
msgid ""
Packit 1470ea
"If all else fails, tell the user that the code is going to be slow and put "
Packit 1470ea
"up a progress bar. They won't be as happy as if you had just presented the "
Packit 1470ea
"results, but they will at least know the program hasn't crashed and they can "
Packit 1470ea
"go get a cup of coffee."
Packit 1470ea
msgstr ""
Packit 1470ea
"Om allt annat misslyckas får du varna användaren att koden kommer vara "
Packit 1470ea
"långsam och visa en förloppsindikator. De kommer inte vara så glada som om "
Packit 1470ea
"du bara presenterat resultaten, men de vet i alla fall att programmet inte "
Packit 1470ea
"har kraschat och att de kan gå och ta sig en kopp kaffe."
Packit 1470ea
Packit 1470ea
#. (itstool) path: media
Packit 1470ea
#. This is a reference to an external file such as an image or video. When
Packit 1470ea
#. the file changes, the md5 hash will change to let you know you need to
Packit 1470ea
#. update your localized copy. The msgstr is not used at all. Set it to
Packit 1470ea
#. whatever you like once you have updated your copy of the file.
Packit 1470ea
#: C/massif.page:50
Packit 1470ea
msgctxt "_"
Packit 1470ea
msgid ""
Packit 1470ea
"external ref='figures/massif-before.png' "
Packit 1470ea
"md5='1a6b2ace548e6789ab8bfacb3727b345'"
Packit 1470ea
msgstr ""
Packit 1470ea
"external ref='figures/massif-before.png' "
Packit 1470ea
"md5='1a6b2ace548e6789ab8bfacb3727b345'"
Packit 1470ea
Packit 1470ea
#. (itstool) path: media
Packit 1470ea
#. This is a reference to an external file such as an image or video. When
Packit 1470ea
#. the file changes, the md5 hash will change to let you know you need to
Packit 1470ea
#. update your localized copy. The msgstr is not used at all. Set it to
Packit 1470ea
#. whatever you like once you have updated your copy of the file.
Packit 1470ea
#: C/massif.page:124
Packit 1470ea
msgctxt "_"
Packit 1470ea
msgid ""
Packit 1470ea
"external ref='figures/massif-after.png' "
Packit 1470ea
"md5='36d1b4ad7ab49b28b69ad3eabbaa7069'"
Packit 1470ea
msgstr ""
Packit 1470ea
"external ref='figures/massif-after.png' "
Packit 1470ea
"md5='36d1b4ad7ab49b28b69ad3eabbaa7069'"
Packit 1470ea
Packit 1470ea
#. (itstool) path: page/title
Packit 1470ea
#: C/massif.page:7
Packit 1470ea
msgid "Using <app>Massif</app> for Profiling Memory Use in GNOME Software"
Packit 1470ea
msgstr ""
Packit 1470ea
"Använda <app>Massif</app> för att profilera minnesanvändning i GNOME-program"
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:13
Packit 1470ea
msgid ""
Packit 1470ea
"<app>Massif</app> is a member of the 
Packit 1470ea
"\">valgrind</link> suite of memory-profiling tools. Its purpose is to give a "
Packit 1470ea
"detailed view of dynamic memory usage during the lifetime of the program. "
Packit 1470ea
"Specifically it records the memory use of the heap and the stack."
Packit 1470ea
msgstr ""
Packit 1470ea
"<app>Massif</app> är en medlem av 
Packit 1470ea
"\">valgrind</link>-sviten av verktyg för minnesprofilering. Dess syfte är "
Packit 1470ea
"att ge en detaljerad överblick över dynamisk minnesanvändning under "
Packit 1470ea
"programmets livstid. Specifikt lagrar det minnesanvändningen för heapen och "
Packit 1470ea
"stacken."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:16
Packit 1470ea
msgid ""
Packit 1470ea
"The heap is the region of memory which is allocated with functions like "
Packit 1470ea
"malloc. It grows on demand and is usually the largest region of memory in a "
Packit 1470ea
"program. The stack is where all the local data for functions is stored. This "
Packit 1470ea
"includes the \"automatic\" variables in C and the return address for "
Packit 1470ea
"subroutines. The stack is typically a lot smaller and a lot more active than "
Packit 1470ea
"the heap. We won't consider the stack explicitly since <app>Massif</app> "
Packit 1470ea
"treats it as though it were just another part of the heap. <app>Massif</app> "
Packit 1470ea
"also gives information about how much memory is used to manage the heap."
Packit 1470ea
msgstr ""
Packit 1470ea
"Heapen är minnesregionen som allokeras med funktioner som malloc. Den växer "
Packit 1470ea
"enligt efterfrågan och är vanligen den största minnesregionen i ett program. "
Packit 1470ea
"Stacken är där alla lokala data för funktioner lagras. Detta inkluderar de "
Packit 1470ea
"”automatiska” variablerna i C och returadressen för subrutiner. Stacken är "
Packit 1470ea
"vanligen mycket mindre och mycket mer aktiv än heapen. Vi kommer inte "
Packit 1470ea
"explicit tänka närmare på stacken eftersom <app>Massif</app> behandlar den "
Packit 1470ea
"som att den bara vore en annan del av heapen. <app>Massif</app> ger också "
Packit 1470ea
"information om hur mycket minne som används för att hantera heapen."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:18
Packit 1470ea
msgid ""
Packit 1470ea
"<app>Massif</app> produces two output files: a graphical overview in a "
Packit 1470ea
"postscript file and a detailed breakdown in a text file."
Packit 1470ea
msgstr ""
Packit 1470ea
"<app>Massif</app> skapar två utdatafiler: en grafisk överblick i en "
Packit 1470ea
"postscript-fil och en detaljerad sammanställning i en textfil."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/title
Packit 1470ea
#: C/massif.page:23
Packit 1470ea
msgid "Using <app>Massif</app> with GNOME"
Packit 1470ea
msgstr "Använda <app>Massif</app> med GNOME"
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:24
Packit 1470ea
msgid ""
Packit 1470ea
"<app>Massif</app> has very few options and for many programs does not need "
Packit 1470ea
"them. However for GNOME applications, where memory allocation might be "
Packit 1470ea
"buried deep in either glib or GTK, the number of levels down the call-stack "
Packit 1470ea
"Massif descends needs to be increased. This is achieved using the --depth "
Packit 1470ea
"parameter. By default this is 3; increasing it to 5 will guarantee the call-"
Packit 1470ea
"stack reaches down to your code. One or two more levels may also be "
Packit 1470ea
"desirable to provide your code with some context. Since the level of detail "
Packit 1470ea
"becomes quickly overwhelming it is best to start with the smaller depth "
Packit 1470ea
"parameter and only increase it when it becomes apparent that it isn't "
Packit 1470ea
"sufficient."
Packit 1470ea
msgstr ""
Packit 1470ea
"<app>Massif</app> har väldigt få flaggor och behöver dem inte för många "
Packit 1470ea
"program. För GNOME-program, där minnesallokering kan vara gömd djupt nere i "
Packit 1470ea
"antingen glib eller GTK, kan dock antalet nivåer som Massif går ner för "
Packit 1470ea
"anropsstacken behöva ökas. Detta uppnås med parametern --depth. Denna är som "
Packit 1470ea
"standard 3. Att öka den till 5 garanterar att anropsstacken når ner till din "
Packit 1470ea
"kod. En eller två ytterligare nivåer kan också vara önskvärda för att "
Packit 1470ea
"tillhandahålla mer sammanhang till din kod. Eftersom detaljnivån snabbt blir "
Packit 1470ea
"överväldigande är det bäst att börja med den mindre djupparametern och "
Packit 1470ea
"endast öka den då det blir uppenbart att den är otillräcklig."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:27
Packit 1470ea
msgid ""
Packit 1470ea
"It is also useful to tell <app>Massif</app> which functions allocate memory "
Packit 1470ea
"in glib. It removes an unnecessary layer of function calls from the reports "
Packit 1470ea
"and gives you a clearer idea of what code is allocating memory. The "
Packit 1470ea
"allocating functions in glib are g_malloc, g_malloc0, g_realloc, "
Packit 1470ea
"g_try_malloc, and g_mem_chunk_alloc. You use the --alloc-fn option to tell "
Packit 1470ea
"Massif about them."
Packit 1470ea
msgstr ""
Packit 1470ea
"Det är också användbart att berätta för <app>Massif</app> vilka funktioner "
Packit 1470ea
"som allokerar minne i glib. Det tar bort ett onödigt lager av funktionsanrop "
Packit 1470ea
"från rapporterna och ger dig en tydligare bild av vilken kod som allokerar "
Packit 1470ea
"minne. De allokerande funktionerna i glib är g_malloc, g_malloc0, g_realloc, "
Packit 1470ea
"g_try_malloc och g_mem_chunk_alloc. Du använder flaggan --alloc-fn för att "
Packit 1470ea
"informera Massif om dem."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:30
Packit 1470ea
msgid "Your command-line should therefore look something like:"
Packit 1470ea
msgstr "Din kommandorad bör därför se ut något i stil med:"
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/code
Packit 1470ea
#: C/massif.page:33
Packit 1470ea
#, no-wrap
Packit 1470ea
msgid ""
Packit 1470ea
"\n"
Packit 1470ea
"valgrind --tool=massif --depth=5  --alloc-fn=g_malloc --alloc-fn=g_realloc --alloc-fn=g_try_malloc \\\n"
Packit 1470ea
"         --alloc-fn=g_malloc0 --alloc-fn=g_mem_chunk_alloc swell-foop\n"
Packit 1470ea
"        "
Packit 1470ea
msgstr ""
Packit 1470ea
"\n"
Packit 1470ea
"valgrind --tool=massif --depth=5  --alloc-fn=g_malloc --alloc-fn=g_realloc --alloc-fn=g_try_malloc \\\n"
Packit 1470ea
"         --alloc-fn=g_malloc0 --alloc-fn=g_mem_chunk_alloc swell-foop\n"
Packit 1470ea
"        "
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:37
Packit 1470ea
msgid ""
Packit 1470ea
"<app>Swell Foop</app> is the program we will be using as an example. Be "
Packit 1470ea
"warned that, since valgrind emulates the CPU, it will run very "
Packit 1470ea
"slowly. You will also need a lot of memory."
Packit 1470ea
msgstr ""
Packit 1470ea
"<app>Swell Foop</app> är programmet vi kommer använda som ett exempel. Var "
Packit 1470ea
"redo på att eftersom valgrind emulerar processorn så kommer det köra "
Packit 1470ea
"väldigt långsamt. Du kommer också behöva mycket minne."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/title
Packit 1470ea
#: C/massif.page:41
Packit 1470ea
msgid "Interpreting the Results"
Packit 1470ea
msgstr "Tolka resultaten"
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:42
Packit 1470ea
msgid ""
Packit 1470ea
"The graphical output of <app>Massif</app> is largely self explanatory. Each "
Packit 1470ea
"band represents the memory allocated by one function over time. Once you "
Packit 1470ea
"identify which bands are using the most memory, usually the big thick ones "
Packit 1470ea
"at the top you will have to consult the text file for the details."
Packit 1470ea
msgstr ""
Packit 1470ea
"Grafiskt utdata för <app>Massif</app> är i stort självförklarande. Varje "
Packit 1470ea
"band representerar minnet allokerat av en funktion över tid. Då du väl "
Packit 1470ea
"identifierat vilka band som använder mest minne, oftast de tjocka banden "
Packit 1470ea
"högst upp, kommer du att behöva läsa textfilen för detaljer."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:45
Packit 1470ea
msgid ""
Packit 1470ea
"The text file is arranged as a hierarchy of sections, at the top is a list "
Packit 1470ea
"of the worst memory users arranged in order of decreasing spacetime. Below "
Packit 1470ea
"this are further sections, each breaking the results down into finer detail "
Packit 1470ea
"as you proceed down the call-stack. To illustrate this we will use the "
Packit 1470ea
"output of the command above."
Packit 1470ea
msgstr ""
Packit 1470ea
"Textfilen är arrangerad som en hierarki av avsnitt, högst upp är en lista "
Packit 1470ea
"över de värsta minnesanvändarna arrangerade i ordning efter sjunkande "
Packit 1470ea
"utrymmestid. Under detta är vidare avsnitt som vardera delar upp resultaten "
Packit 1470ea
"i större detalj allt efter att du fortsätter ner för anropsstacken. För att "
Packit 1470ea
"illustrera detta kommer vi visa utdata för kommandot ovan."
Packit 1470ea
Packit 1470ea
#. (itstool) path: figure/title
Packit 1470ea
#: C/massif.page:49
Packit 1470ea
msgid ""
Packit 1470ea
"<app>Massif</app> output for the unoptimized version of the <app>Swell Foop</"
Packit 1470ea
"app> program."
Packit 1470ea
msgstr ""
Packit 1470ea
"Utdata från <app>Massif</app> för den ej optimerade versionen av programmet "
Packit 1470ea
"<app>Swell Foop</app>."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:52
Packit 1470ea
msgid ""
Packit 1470ea
"The image above shows a typical postscript output from <app>Massif</app>. "
Packit 1470ea
"This is the result you would get from playing a single game of <app>Swell "
Packit 1470ea
"Foop</app> (version 2.8.0) and then quitting. The postscript file will have "
Packit 1470ea
"a name like <file>massif.12345.ps</file> and the text file will be called "
Packit 1470ea
"<file>massif.12345.txt</file>. The number in the middle is the process ID of "
Packit 1470ea
"the program that was examined. If you actually try this example you will "
Packit 1470ea
"find two versions of each file, with slightly different numbers, this is "
Packit 1470ea
"because <app>Swell Foop</app> starts a second process and <app>Massif</app> "
Packit 1470ea
"follows that too. We will ignore this second process, it consumes very "
Packit 1470ea
"little memory."
Packit 1470ea
msgstr ""
Packit 1470ea
"Bilden ovan visar typiskt postscript-utdata från <app>Massif</app>. Detta är "
Packit 1470ea
"resultatet du skulle få av att spela en omgång <app>Swell Foop</app> "
Packit 1470ea
"(version 2.8.0) och sedan avsluta. Postscript-filen kommer ha ett namn som "
Packit 1470ea
"<file>massif.12345.ps</file> och textfilen kommer att kallas "
Packit 1470ea
"<file>massif.12345.txt</file>. Numret i mitten är process-ID:t för "
Packit 1470ea
"programmet som undersöktes. Om du faktiskt prövar detta exempel kommer du "
Packit 1470ea
"hitta två versioner av varje fil, med något olika nummer, detta beror på att "
Packit 1470ea
"<app>Swell Foop</app> startar en andra process och <app>Massif</app> följer "
Packit 1470ea
"den också. Vi kommer ignorera denna andra process, den förbrukar mycket lite "
Packit 1470ea
"minne."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:66
Packit 1470ea
msgid ""
Packit 1470ea
"At the top of the graph we see a large yellow band labelled gdk_pixbuf_new. "
Packit 1470ea
"This seems like an ideal candidate for optimization, but we will need to use "
Packit 1470ea
"the text file to find out what is calling gdk_pixbuf_new. The top of the "
Packit 1470ea
"text file will look something like this:"
Packit 1470ea
msgstr ""
Packit 1470ea
"Högst upp på grafen ser vi ett stort gult band märkt gdk_pixbuf_new. Detta "
Packit 1470ea
"verkar vara en ideal kandidat för optimering, men vi kommer behöva använda "
Packit 1470ea
"textfilen för att få reda på vad som anropar gdk_pixbuf_new. Början på "
Packit 1470ea
"textfilen kommer se ut något i stil med detta:"
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/code
Packit 1470ea
#: C/massif.page:69
Packit 1470ea
#, no-wrap
Packit 1470ea
msgid ""
Packit 1470ea
"\n"
Packit 1470ea
"Command: ./swell-foop\n"
Packit 1470ea
"\n"
Packit 1470ea
"== 0 ===========================\n"
Packit 1470ea
"Heap allocation functions accounted for 90.4% of measured spacetime\n"
Packit 1470ea
"\n"
Packit 1470ea
"Called from:\n"
Packit 1470ea
"  28.8% : 0x6BF83A: gdk_pixbuf_new (in /usr/lib/libgdk_pixbuf-2.0.so.0.400.9)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    6.1% : 0x5A32A5: g_strdup (in /usr/lib/libglib-2.0.so.0.400.6)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    5.9% : 0x510B3C: (within /usr/lib/libfreetype.so.6.3.7)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    3.5% : 0x2A4A6B: __gconv_open (in /lib/tls/libc-2.3.3.so)\n"
Packit 1470ea
"        "
Packit 1470ea
msgstr ""
Packit 1470ea
"\n"
Packit 1470ea
"Command: ./swell-foop\n"
Packit 1470ea
"\n"
Packit 1470ea
"== 0 ===========================\n"
Packit 1470ea
"Heap allocation functions accounted for 90.4% of measured spacetime\n"
Packit 1470ea
"\n"
Packit 1470ea
"Called from:\n"
Packit 1470ea
"  28.8% : 0x6BF83A: gdk_pixbuf_new (in /usr/lib/libgdk_pixbuf-2.0.so.0.400.9)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    6.1% : 0x5A32A5: g_strdup (in /usr/lib/libglib-2.0.so.0.400.6)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    5.9% : 0x510B3C: (within /usr/lib/libfreetype.so.6.3.7)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    3.5% : 0x2A4A6B: __gconv_open (in /lib/tls/libc-2.3.3.so)\n"
Packit 1470ea
"        "
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:84
Packit 1470ea
msgid ""
Packit 1470ea
"The line with the '=' signs indicates how far down the stack trace we are, "
Packit 1470ea
"in this case we are at the top. After this it lists the heaviest users of "
Packit 1470ea
"memory in order of decreasing spacetime. Spacetime is the product of the "
Packit 1470ea
"amount of memory used and how long it was used for. It corresponds to the "
Packit 1470ea
"area of the bands in the graph. This part of the file tells us what we "
Packit 1470ea
"already know: most of the spacetime is dedicated to gdk_pixbuf_new. To find "
Packit 1470ea
"out what called gdk_pixbuf_new we need to search further down the text file:"
Packit 1470ea
msgstr ""
Packit 1470ea
"Raden med ”=”-tecknen indikerar hur långt ner för stackspåret vi är, i detta "
Packit 1470ea
"fall på toppen. Efter detta listar det de tyngsta användarna av minne "
Packit 1470ea
"ordnade efter sjunkande utrymmestid. Utrymmestid är produkten av mängden "
Packit 1470ea
"minne som används och hur länge det användes. Det motsvarar arean av banden "
Packit 1470ea
"i grafen, Denna del av filen talar om för oss vad vi redan vet: att den "
Packit 1470ea
"mesta utrymmestiden ägnas åt gdk_pixbuf_new. För att ta reda på vad som "
Packit 1470ea
"anropade gdk_pixbuf_new måste vi söka längre ner i textfilen:"
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/code
Packit 1470ea
#: C/massif.page:87
Packit 1470ea
#, no-wrap
Packit 1470ea
msgid ""
Packit 1470ea
"\n"
Packit 1470ea
"== 4 ===========================\n"
Packit 1470ea
"Context accounted for 28.8% of measured spacetime\n"
Packit 1470ea
"  0x6BF83A: gdk_pixbuf_new (in /usr/lib/libgdk_pixbuf-2.0.so.0.400.9)\n"
Packit 1470ea
"  0x3A998998: (within /usr/lib/gtk-2.0/2.4.0/loaders/libpixbufloader-png.so)\n"
Packit 1470ea
"  0x6C2760: (within /usr/lib/libgdk_pixbuf-2.0.so.0.400.9)\n"
Packit 1470ea
"  0x6C285E: gdk_pixbuf_new_from_file (in /usr/lib/libgdk_pixbuf-2.0.so.0.400.9)\n"
Packit 1470ea
"\n"
Packit 1470ea
"Called from:\n"
Packit 1470ea
"  27.8% : 0x804C1A3: load_scenario (swell-foop.c:463)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    0.9% : 0x3E8095E: (within /usr/lib/libgnomeui-2.so.0.792.0)\n"
Packit 1470ea
"\n"
Packit 1470ea
"  and 1 other insignificant place\n"
Packit 1470ea
"        "
Packit 1470ea
msgstr ""
Packit 1470ea
"\n"
Packit 1470ea
"== 4 ===========================\n"
Packit 1470ea
"Context accounted for 28.8% of measured spacetime\n"
Packit 1470ea
"  0x6BF83A: gdk_pixbuf_new (in /usr/lib/libgdk_pixbuf-2.0.so.0.400.9)\n"
Packit 1470ea
"  0x3A998998: (within /usr/lib/gtk-2.0/2.4.0/loaders/libpixbufloader-png.so)\n"
Packit 1470ea
"  0x6C2760: (within /usr/lib/libgdk_pixbuf-2.0.so.0.400.9)\n"
Packit 1470ea
"  0x6C285E: gdk_pixbuf_new_from_file (in /usr/lib/libgdk_pixbuf-2.0.so.0.400.9)\n"
Packit 1470ea
"\n"
Packit 1470ea
"Called from:\n"
Packit 1470ea
"  27.8% : 0x804C1A3: load_scenario (swell-foop.c:463)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    0.9% : 0x3E8095E: (within /usr/lib/libgnomeui-2.so.0.792.0)\n"
Packit 1470ea
"\n"
Packit 1470ea
"  and 1 other insignificant place\n"
Packit 1470ea
"        "
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:102
Packit 1470ea
msgid ""
Packit 1470ea
"The first line tells us we are now four levels deep into the stack. Below it "
Packit 1470ea
"is a listing of the function calls that leads from here to gdk_pixbuf_new. "
Packit 1470ea
"Finally there is a list of functions that are at the next level down and "
Packit 1470ea
"call these functions. There are, of course, also entries for levels 1, 2, "
Packit 1470ea
"and 3, but this is the first level to reach right down through the GDK code "
Packit 1470ea
"to the <app>Swell Foop</app> code. From this listing, we can see instantly "
Packit 1470ea
"that the problem code is load_scenario."
Packit 1470ea
msgstr ""
Packit 1470ea
"Den första raden säger oss att vi är fyra nivåer ner i stacken. Under den är "
Packit 1470ea
"en lista över de funktionsanrop som leder härifrån till gdk_pixbuf_new. "
Packit 1470ea
"Slutligen finns det en lista över funktioner som är på nästa nivå neråt och "
Packit 1470ea
"anropar dessa funktioner. Det finns förstås även poster för nivå 1, 2 och 3, "
Packit 1470ea
"men detta är den första nivån som når rakt genom GDK-koden till <app>Swell "
Packit 1470ea
"Foop</app>-koden. Från denna lista kan vi omedelbart se att problemkoden är "
Packit 1470ea
"load_scenario."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:105
Packit 1470ea
msgid ""
Packit 1470ea
"Now that we know what part of our code is using all the spacetime we can "
Packit 1470ea
"look at it and find out why. It turns out that the load_scenario is loading "
Packit 1470ea
"a pixbuf from file and then never freeing that memory. Having identified the "
Packit 1470ea
"problem code, we can start to fix it."
Packit 1470ea
msgstr ""
Packit 1470ea
"Nu när vi vet vilken del av vår kod som använder all utrymmestid kan vi "
Packit 1470ea
"titta på den och ta reda på varför. Det visar sig att load_scenario läser in "
Packit 1470ea
"en pixbuf från fil och sedan aldrig frigör det minnet. Eftersom vi har "
Packit 1470ea
"identifierat problemkoden så kan vi fixa den."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/title
Packit 1470ea
#: C/massif.page:110
Packit 1470ea
msgid "Acting on the Results"
Packit 1470ea
msgstr "Agera på resultaten"
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:111
Packit 1470ea
msgid ""
Packit 1470ea
"Reducing spacetime consumption is good, but there are two ways of reducing "
Packit 1470ea
"it and they are not equal. You can either reduce the amount of memory "
Packit 1470ea
"allocated, or reduce the amount of time it is allocated for. Consider for a "
Packit 1470ea
"moment a model system with only two processes running. Both processes use up "
Packit 1470ea
"almost all the physical RAM and if they overlap at all then the system will "
Packit 1470ea
"swap and everything will slow down. Obviously if we reduce the memory usage "
Packit 1470ea
"of each process by a factor of two then they can peacefully coexist without "
Packit 1470ea
"the need for swapping. If instead we reduce the time the memory is allocated "
Packit 1470ea
"by a factor of two then the two programs can coexist, but only as long as "
Packit 1470ea
"their periods of high memory use don't overlap. So it is better to reduce "
Packit 1470ea
"the amount of memory allocated."
Packit 1470ea
msgstr ""
Packit 1470ea
"Att reducera användning av utrymmestid är bra, men det finns två sätt att "
Packit 1470ea
"minska det och de är inte likvärdiga. Du kan antingen minska mängden minne "
Packit 1470ea
"som allokeras, eller minska tidsperioden som det är allokerat. Tänk dig nu "
Packit 1470ea
"ett modalt system där bara två processer körs. Båda processerna använder upp "
Packit 1470ea
"nästan allt fysiskt RAM-minne, och om de någonsin överlappar kommer systemet "
Packit 1470ea
"använda växlingsutrymme och allt kommer att sakta ner. Uppenbarligen kan de "
Packit 1470ea
"samexistera utan behov att använda växlingsutrymme om vi minskar "
Packit 1470ea
"minnesanvändningen för varje process med en faktor två. Om vi istället "
Packit 1470ea
"minskar tiden minne är allokerat kan programmen samexistera, men bara så "
Packit 1470ea
"länge deras perioder av hög minnesanvändning inte överlappar. Det är därför "
Packit 1470ea
"bättre att minska mängden allokerat minne."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:114
Packit 1470ea
msgid ""
Packit 1470ea
"Unfortunately, the choice of optimization is also constrained by the needs "
Packit 1470ea
"of the program. The size of the pixbuf data in <app>Swell Foop</app> is "
Packit 1470ea
"determined by the size of the game's graphics and cannot be easily reduced. "
Packit 1470ea
"However, the amount of time it spends loaded into memory can be drastically "
Packit 1470ea
"reduced. The image below shows the <app>Massif</app> analysis of <app>Swell "
Packit 1470ea
"Foop</app> after being altered to dispose of the pixbufs once the images "
Packit 1470ea
"have been loaded into the X server."
Packit 1470ea
msgstr ""
Packit 1470ea
"Dessvärre begränsas valet av optimering även av programmets behov. Storleken "
Packit 1470ea
"på pixbuf-data i <app>Swell Foop</app> avgörs av storleken på spelets grafik "
Packit 1470ea
"och kan inte minskas på något lätt sätt. Tidsperioden som det är inläst i "
Packit 1470ea
"minne kan dock minskas drastiskt. Bilden nedan visar analysen <app>Massif</"
Packit 1470ea
"app> har gjort av <app>Swell Foop</app> efter att programmet ändrats för att "
Packit 1470ea
"göra sig av med pixbufar då bilderna har lästs in i X-servern."
Packit 1470ea
Packit 1470ea
#. (itstool) path: figure/title
Packit 1470ea
#: C/massif.page:123
Packit 1470ea
msgid ""
Packit 1470ea
"<app>Massif</app> output for the optimized <app>Swell Foop</app> program."
Packit 1470ea
msgstr ""
Packit 1470ea
"<app>Massif</app>-utdata för det optimerade <app>Swell Foop</app>-programmet."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:126
Packit 1470ea
msgid ""
Packit 1470ea
"The spacetime use of gdk_pixbuf_new is now a thin band that only spikes "
Packit 1470ea
"briefly (it is now the sixteenth band down and shaded magenta). As a bonus, "
Packit 1470ea
"the peak memory use has dropped by 200 kB since the spike occurs before "
Packit 1470ea
"other memory is allocated. If two processes like this were run together the "
Packit 1470ea
"chances of the peak memory usage coinciding, and hence the risk of swapping, "
Packit 1470ea
"would be quite low."
Packit 1470ea
msgstr ""
Packit 1470ea
"Användningen av utrymmestid för gdk_pixbuf_new är nu ett tunt band som "
Packit 1470ea
"endast tillfälligt når toppar (det är nu det sextonde bandet uppifrån och "
Packit 1470ea
"har färgen magenta). Som en bonus minskar minnesanvändningstoppen med 200 kB "
Packit 1470ea
"efter det att toppen inträffat innan annat minne allokeras. Om två processer "
Packit 1470ea
"som denna körs samtidigt är risken att topparna inträffar samtidigt, och "
Packit 1470ea
"därmed risken att växlingsutrymme behöver användas, ganska låg."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:129
Packit 1470ea
msgid ""
Packit 1470ea
"Can we do better ? A quick examination of <app>Massif</app>'s text output "
Packit 1470ea
"reveals: g_strdup to be the new major offender."
Packit 1470ea
msgstr ""
Packit 1470ea
"Kan vi göra bättre? En snabb undersökning av textutdata från <app>Massif</"
Packit 1470ea
"app> visar att g_strdup nu är den största minnestjuven."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/code
Packit 1470ea
#: C/massif.page:132
Packit 1470ea
#, no-wrap
Packit 1470ea
msgid ""
Packit 1470ea
"\n"
Packit 1470ea
"Command: ./swell-foop\n"
Packit 1470ea
"\n"
Packit 1470ea
"== 0 ===========================\n"
Packit 1470ea
"Heap allocation functions accounted for 87.6% of measured spacetime\n"
Packit 1470ea
"\n"
Packit 1470ea
"Called from:\n"
Packit 1470ea
"    7.7% : 0x5A32A5: g_strdup (in /usr/lib/libglib-2.0.so.0.400.6)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    7.6% : 0x43BC9F: (within /usr/lib/libgdk-x11-2.0.so.0.400.9)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    6.9% : 0x510B3C: (within /usr/lib/libfreetype.so.6.3.7)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    5.2% : 0x2A4A6B: __gconv_open (in /lib/tls/libc-2.3.3.so)\n"
Packit 1470ea
"        "
Packit 1470ea
msgstr ""
Packit 1470ea
"\n"
Packit 1470ea
"Command: ./swell-foop\n"
Packit 1470ea
"\n"
Packit 1470ea
"== 0 ===========================\n"
Packit 1470ea
"Heap allocation functions accounted for 87.6% of measured spacetime\n"
Packit 1470ea
"\n"
Packit 1470ea
"Called from:\n"
Packit 1470ea
"    7.7% : 0x5A32A5: g_strdup (in /usr/lib/libglib-2.0.so.0.400.6)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    7.6% : 0x43BC9F: (within /usr/lib/libgdk-x11-2.0.so.0.400.9)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    6.9% : 0x510B3C: (within /usr/lib/libfreetype.so.6.3.7)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    5.2% : 0x2A4A6B: __gconv_open (in /lib/tls/libc-2.3.3.so)\n"
Packit 1470ea
"        "
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:147
Packit 1470ea
msgid ""
Packit 1470ea
"If we look closer though we see that it is called from many, many, places."
Packit 1470ea
msgstr ""
Packit 1470ea
"Om vi tittar närmare ser vi dock att det anropas från många, många ställen."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/code
Packit 1470ea
#: C/massif.page:150
Packit 1470ea
#, no-wrap
Packit 1470ea
msgid ""
Packit 1470ea
"\n"
Packit 1470ea
"== 1 ===========================\n"
Packit 1470ea
"Context accounted for  7.7% of measured spacetime\n"
Packit 1470ea
"  0x5A32A5: g_strdup (in /usr/lib/libglib-2.0.so.0.400.6)\n"
Packit 1470ea
"\n"
Packit 1470ea
"Called from:\n"
Packit 1470ea
"    1.8% : 0x8BF606: gtk_icon_source_copy (in /usr/lib/libgtk-x11-2.0.so.0.400.9)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    1.1% : 0x67AF6B: g_param_spec_internal (in /usr/lib/libgobject-2.0.so.0.400.6)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    0.9% : 0x91FCFC: (within /usr/lib/libgtk-x11-2.0.so.0.400.9)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    0.8% : 0x57EEBF: g_quark_from_string (in /usr/lib/libglib-2.0.so.0.400.6)\n"
Packit 1470ea
"\n"
Packit 1470ea
"  and 155 other insignificant places\n"
Packit 1470ea
"        "
Packit 1470ea
msgstr ""
Packit 1470ea
"\n"
Packit 1470ea
"== 1 ===========================\n"
Packit 1470ea
"Context accounted for  7.7% of measured spacetime\n"
Packit 1470ea
"  0x5A32A5: g_strdup (in /usr/lib/libglib-2.0.so.0.400.6)\n"
Packit 1470ea
"\n"
Packit 1470ea
"Called from:\n"
Packit 1470ea
"    1.8% : 0x8BF606: gtk_icon_source_copy (in /usr/lib/libgtk-x11-2.0.so.0.400.9)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    1.1% : 0x67AF6B: g_param_spec_internal (in /usr/lib/libgobject-2.0.so.0.400.6)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    0.9% : 0x91FCFC: (within /usr/lib/libgtk-x11-2.0.so.0.400.9)\n"
Packit 1470ea
"\n"
Packit 1470ea
"    0.8% : 0x57EEBF: g_quark_from_string (in /usr/lib/libglib-2.0.so.0.400.6)\n"
Packit 1470ea
"\n"
Packit 1470ea
"  and 155 other insignificant places\n"
Packit 1470ea
"        "
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:166
Packit 1470ea
msgid ""
Packit 1470ea
"We now face diminishing returns for our optimization efforts. The graph "
Packit 1470ea
"hints at another possible approach: Both the \"other\" and \"heap admin\" "
Packit 1470ea
"bands are quite large. This tells us that there are a lot of small "
Packit 1470ea
"allocations being made from a variety of places. Eliminating these will be "
Packit 1470ea
"difficult, but if they can be grouped then the individual allocations can be "
Packit 1470ea
"larger and the \"heap admin\" overhead can be reduced."
Packit 1470ea
msgstr ""
Packit 1470ea
"Vi möter nu avtagande resultat för våra optimeringsförsök. Grafen tipsar om "
Packit 1470ea
"en annan möjlig infallsvinkel: både bandet ”other” och ”heap admin” är "
Packit 1470ea
"ganska stort. Detta säger oss att det finns många små allokeringar som görs "
Packit 1470ea
"från olika ställen. Att eliminera dessa blir svårt, men om de kunde "
Packit 1470ea
"grupperas skulle individuella allokeringar kunna vara större och kostnaden "
Packit 1470ea
"för ”heap admin” kunna minskas."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/title
Packit 1470ea
#: C/massif.page:171
Packit 1470ea
msgid "Caveats"
Packit 1470ea
msgstr "Förbehåll"
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:172
Packit 1470ea
msgid ""
Packit 1470ea
"There are a couple of things to watch out for: Firstly, spacetime is only "
Packit 1470ea
"reported as a percentage, you have to compare it to the overall size of the "
Packit 1470ea
"program to decide if the amount of memory is worth pursuing. The graph, with "
Packit 1470ea
"its kilobyte vertical axis, is good for this."
Packit 1470ea
msgstr ""
Packit 1470ea
"Det finns några saker att vara uppmärksam på: den första är att utrymmestid "
Packit 1470ea
"endast rapporteras som en procentsats, du måste jämföra den med programmets "
Packit 1470ea
"totala storlek för att avgöra om mängden minne är värd titta närmare på. "
Packit 1470ea
"Grafen är med sin vertikala kilobyteaxel bra för detta."
Packit 1470ea
Packit 1470ea
#. (itstool) path: section/p
Packit 1470ea
#: C/massif.page:175
Packit 1470ea
msgid ""
Packit 1470ea
"Secondly, <app>Massif</app> only takes into account the memory used by your "
Packit 1470ea
"own program. Resources like pixmaps are stored in the X server and aren't "
Packit 1470ea
"considered by <app>Massif</app>. In the <app>Swell Foop</app> example we "
Packit 1470ea
"have actually only moved the memory consumption from client-side pixbufs to "
Packit 1470ea
"server-side pixmaps. Even though we cheated there are performance gains. "
Packit 1470ea
"Keeping the image data in the X server makes the graphics routines quicker "
Packit 1470ea
"and removes a lot of inter-process communication. Also, the pixmaps will be "
Packit 1470ea
"stored in a native graphics format which is often more compact than the 32-"
Packit 1470ea
"bit RGBA format used by gdk_pixbuf. To measure the effect of pixmaps, and "
Packit 1470ea
"other X resources use the 
Packit 1470ea
"xrestop\">xrestop</link> program."
Packit 1470ea
msgstr ""
Packit 1470ea
"Den andra saken är att <app>Massif</app> endast räknar in minne använt av "
Packit 1470ea
"ditt eget program. Resurser som pixmappar lagras i X-servern och räknas inte "
Packit 1470ea
"av <app>Massif</app>. I <app>Swell Foop</app>-exemplet har vi faktiskt bara "
Packit 1470ea
"förflyttat minnesförbrukningen från pixbufar på klientsidan till pixmappar "
Packit 1470ea
"på serversidan. Även om vi fuskade uppstår det prestandavinster. Att behålla "
Packit 1470ea
"bilddata i X-servern gör grafikrutinerna snabbare och tar bort mycket "
Packit 1470ea
"kommunikation mellan processer. Pixmapparna kommer också lagras i ett "
Packit 1470ea
"inhemskt grafikformat vilket ofta är mer kompakt än det 32-bitars RGBA-"
Packit 1470ea
"format som används av gdk_pixbuf. För att mäta effekten av pixmappar och "
Packit 1470ea
"andra X-resurser kan du använda programmet 
Packit 1470ea
"freedesktop.org/Software/xrestop\">xrestop</link>."