Look at the formula of the compound containing oxygen. In some cases it's obvious, e.g. a mole of $\ce{O2}$ in the air. In other cases, you'd need to know how oxygen is liberated. For example, one mole of hydrogen peroxide, $\ce{H2O2}$, liberates only one **half** mole of **gaseous** oxygen: $\ce{H2O2 -> H2O + 1/2 O2}$ or better, $\ce{2H2O2 -> 2H2O + O2}$.

Er, umm... why write this as $\ce{1/2 O2}$, rather than one $\ce{O}$? The answer is because though the oxygen might be liberated in a *very* reactive atomic, rather than molecular, form, as in ["piranha solution"][1], it rapidly links together as molecular $\ce{O2}$.

Yes, it can be confusing, since there are a number [oxygen allotropes][2]. Aside from $\ce{O2}$, or dioxygen, which makes up about 1/5 of the air, there is $\ce{O3}$, ozone, and  [*solid* oxygen][3] may contain $\ce{O8}$. And, as [Herr Lehrer states][4], "There may be many others, but they haven't been discavard".


  [1]: https://en.wikipedia.org/wiki/Piranha_solution
  [2]: https://en.wikipedia.org/wiki/Allotropes_of_oxygen
  [3]: https://en.wikipedia.org/wiki/Allotropes_of_oxygen#Phases_of_solid_oxygen
  [4]: https://www.lyricsfreak.com/t/tom+lehrer/the+elements_20138388.html