Running time of the specified Bubble Sort Algorithm

I have been working on a few algorithm questions the last few days, and one bubble sort problem in particular has been giving me headaches.

for (k=1; k <= A.length - 1; k++) {         //Line 1
for (m=1; m <= A.length - k; m++) {      //Line 2
if (A[m-1] > A[m]) {                  //Line 3
Swap (A[m-1], A[m]);                //Line 4
}

Now, I am supposed to find the running time of this algorithm in the worst case scenario, and I know that it is O(n^2), but the problem I am having is finding out how many times is each line executed.

For example, line 1 is going to take n units of time, while line 4 depends on the complexity of function Swap. However, line 2 on the other hand is going to take [(n-1) * ?] units of time (I tried finding out exactly and I got (n-1)*n) and I am stomped with finding how to do the IF statement, but I assume it will take (? - 1) times. IF anyone could give me an explanation on how to do this, I would greatly appreciate it.